home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
netbsd
/
incoming
/
isa-950822.diff
< prev
next >
Wrap
Text File
|
1995-11-21
|
496KB
|
17,599 lines
*** old-NetBSD/src/bin/stty/key.c
--- NetBSD/src/bin/stty/key.c
***************
*** 67,72 ****
--- 67,74 ----
void f_sane __P((struct info *));
void f_size __P((struct info *));
void f_speed __P((struct info *));
+ void f_ostart __P((struct info *));
+ void f_ostop __P((struct info *));
void f_tty __P((struct info *));
__END_DECLS
***************
*** 90,95 ****
--- 92,99 ----
{ "nl", f_nl, F_OFFOK },
{ "old", f_tty, 0 },
{ "ospeed", f_ospeed, F_NEEDARG },
+ { "ostart", f_ostart, 0 },
+ { "ostop", f_ostop, 0 },
{ "raw", f_raw, F_OFFOK },
{ "rows", f_rows, F_NEEDARG },
{ "sane", f_sane, 0 },
***************
*** 302,305 ****
--- 306,325 ----
tmp = TTYDISC;
if (ioctl(0, TIOCSETD, &tmp) < 0)
err(1, "TIOCSETD");
+ }
+
+ void
+ f_ostart(ip)
+ struct info *ip;
+ {
+ if (ioctl (0, TIOCSTART) < 0)
+ err(1, "TIOCSTART");
+ }
+
+ void
+ f_ostop(ip)
+ struct info *ip;
+ {
+ if (ioctl (0, TIOCSTOP) < 0)
+ err(1, "TIOCSTOP");
}
*** old-NetBSD/src/gnu/lib/libg++/iostream/stdstrbufs.C
--- NetBSD/src/gnu/lib/libg++/iostream/stdstrbufs.C
***************
*** 53,62 ****
--- 53,70 ----
#define vt_filebuf __vtbl__7filebuf
extern char vt_filebuf[1];
#elif _G_DOLLAR_IN_LABEL
+ #if __GNUC_MINOR__ >= 5 // XXX I'm not sure it was introduced in 2.5
+ extern char vt_filebuf[1] asm(UNDERSCORE "_vt$7filebuf");
+ #else
extern char vt_filebuf[1] asm(UNDERSCORE "_vt$filebuf");
+ #endif
+ #else
+ #if __GNUC_MINOR__ >= 5 // XXX I'm not sure it was introduced in 2.5
+ extern char vt_filebuf[1] asm(UNDERSCORE "_vt.7filebuf");
#else
extern char vt_filebuf[1] asm(UNDERSCORE "_vt.filebuf");
#endif
+ #endif
#endif /* !defined(vt_filebuf) */
struct _fake_filebuf {
***************
*** 85,93 ****
--- 93,109 ----
#define vt_stdiobuf __vtbl__8stdiobuf
extern char vt_stdiobuf[1];
#elif _G_DOLLAR_IN_LABEL
+ #if __GNUC_MINOR__ >= 5 // XXX I'm not sure it was introduced in 2.5
+ extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt$8stdiobuf");
+ #else
extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt$stdiobuf");
+ #endif
+ #else
+ #if __GNUC_MINOR__ >= 5 // XXX I'm not sure it was introduced in 2.5
+ extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt.8stdiobuf");
#else
extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt.stdiobuf");
+ #endif
#endif
#endif /* !defined(vt_stdiobuf) */
*** old-NetBSD/src/gnu/lib/libg++/iostream/strstream.C
--- NetBSD/src/gnu/lib/libg++/iostream/strstream.C
***************
*** 144,150 ****
// This can lose in pathological cases (ptr near the end
// of the address space). A better solution might be to
// adjust the size on underflow/overflow. FIXME.
! for (int s; s = 2*size, s > 0 && ptr + s > ptr && s < 0x4000000L; )
size = s;
size = s;
#else
--- 144,151 ----
// This can lose in pathological cases (ptr near the end
// of the address space). A better solution might be to
// adjust the size on underflow/overflow. FIXME.
! int s;
! for (; s = 2*size, s > 0 && ptr + s > ptr && s < 0x4000000L; )
size = s;
size = s;
#else
*** old-NetBSD/src/gnu/lib/libg++/libg++/ACG.cc
--- NetBSD/src/gnu/lib/libg++/libg++/ACG.cc
***************
*** 188,194 ****
// Determine the size of the state table
//
! for (register int l = 0;
randomStateTable[l][0] != -1 && randomStateTable[l][1] < size;
l++);
--- 188,195 ----
// Determine the size of the state table
//
! register int l;
! for (l = 0;
randomStateTable[l][0] != -1 && randomStateTable[l][1] < size;
l++);
*** old-NetBSD/src/gnu/lib/libg++/libg++/Fix.cc
--- NetBSD/src/gnu/lib/libg++/libg++/Fix.cc
***************
*** 225,231 ****
longer = y, shorter = x;
if ( r == NULL )
r = new_Fix(longer->len);
! for ( int i=r->siz-1; i >= longer->siz; i-- )
r->s[i] = 0;
for ( ; i >= shorter->siz; i-- )
r->s[i] = longer->s[i];
--- 225,232 ----
longer = y, shorter = x;
if ( r == NULL )
r = new_Fix(longer->len);
! int i;
! for ( i=r->siz-1; i >= longer->siz; i-- )
r->s[i] = 0;
for ( ; i >= shorter->siz; i-- )
r->s[i] = longer->s[i];
***************
*** 251,257 ****
longer = y, shorter = x;
if ( r == NULL )
r = new_Fix(longer->len);
! for ( int i=r->siz-1; i >= longer->siz; i-- )
r->s[i] = 0;
for ( ; i >= shorter->siz; i-- )
r->s[i] = (longer == x ? x->s[i] : -y->s[i]);
--- 252,259 ----
longer = y, shorter = x;
if ( r == NULL )
r = new_Fix(longer->len);
! int i;
! for ( i=r->siz-1; i >= longer->siz; i-- )
r->s[i] = 0;
for ( ; i >= shorter->siz; i-- )
r->s[i] = (longer == x ? x->s[i] : -y->s[i]);
***************
*** 279,285 ****
x = negate(x,X.rep);
if ( ysign )
y = negate(y,Y.rep);
! for ( int i=0; i < r->siz; i++ )
r->s[i] = 0;
for ( i=x->siz-1; i >= 0; i-- )
{
--- 281,288 ----
x = negate(x,X.rep);
if ( ysign )
y = negate(y,Y.rep);
! int i;
! for ( i=0; i < r->siz; i++ )
r->s[i] = 0;
for ( i=x->siz-1; i >= 0; i-- )
{
***************
*** 310,316 ****
(*Fix_range_error_handler)("multiply by int -- int too large");
if ( r == NULL )
r = new_Fix(x->len);
! for ( int i=r->siz-1; i >= x->siz; i-- )
r->s[i] = 0;
int32 a, carry = 0;
for ( ; i > 0; i-- )
--- 313,320 ----
(*Fix_range_error_handler)("multiply by int -- int too large");
if ( r == NULL )
r = new_Fix(x->len);
! int i;
! for ( i=r->siz-1; i >= x->siz; i-- )
r->s[i] = 0;
int32 a, carry = 0;
for ( ; i > 0; i-- )
***************
*** 418,424 ****
int xr = 16 - xl;
uint16 xrmask = 0xffffL >> xr;
! for ( int i=0; i < ilow; i++, rs+=u, xsl+=u, xsr+=u )
*rs = 0;
for ( ; i < ihigh; i++, rs+=u, xsl+=u, xsr+=u )
*rs = (*xsl << xl) + ((*xsr >> xr) & xrmask);
--- 422,429 ----
int xr = 16 - xl;
uint16 xrmask = 0xffffL >> xr;
! int i;
! for ( i=0; i < ilow; i++, rs+=u, xsl+=u, xsr+=u )
*rs = 0;
for ( ; i < ihigh; i++, rs+=u, xsl+=u, xsr+=u )
*rs = (*xsl << xl) + ((*xsr >> xr) & xrmask);
***************
*** 434,440 ****
if ( r == NULL )
r = new_Fix(x->len);
uint32 carry = 1;
! for ( int i=r->siz-1; i >= x->siz; i-- )
r->s[i] = 0;
for ( ; i >= 0; i-- )
{
--- 439,446 ----
if ( r == NULL )
r = new_Fix(x->len);
uint32 carry = 1;
! int i;
! for ( i=r->siz-1; i >= x->siz; i-- )
r->s[i] = 0;
for ( ; i >= 0; i-- )
{
*** old-NetBSD/src/gnu/lib/libg++/libg++/Fix.h
--- NetBSD/src/gnu/lib/libg++/libg++/Fix.h
***************
*** 54,60 ****
public:
Fix();
! Fix(Fix&);
Fix(double);
Fix(int);
Fix(int, const Fix&);
--- 54,60 ----
public:
Fix();
! Fix(const Fix&);
Fix(double);
Fix(int);
Fix(int, const Fix&);
***************
*** 199,205 ****
{
uint16 *ts = to->s, *fs = from->s;
int ilim = to->siz < from->siz ? to->siz : from->siz;
! for ( int i=0; i < ilim; i++ )
*ts++ = *fs++;
for ( ; i < to->siz; i++ )
*ts++ = 0;
--- 199,206 ----
{
uint16 *ts = to->s, *fs = from->s;
int ilim = to->siz < from->siz ? to->siz : from->siz;
! int i;
! for ( i=0; i < ilim; i++ )
*ts++ = *fs++;
for ( ; i < to->siz; i++ )
*ts++ = 0;
***************
*** 229,235 ****
rep = new_Fix(Fix_default_length,d);
}
! inline Fix::Fix(Fix& y)
{
rep = y.rep; rep->ref++;
}
--- 230,236 ----
rep = new_Fix(Fix_default_length,d);
}
! inline Fix::Fix(const Fix& y)
{
rep = y.rep; rep->ref++;
}
*** old-NetBSD/src/gnu/lib/libg++/libg++/Fix24.h
--- NetBSD/src/gnu/lib/libg++/libg++/Fix24.h
***************
*** 355,361 ****
inline Fix24 operator>>(const Fix24& a, int b)
{
! return (a.m >> b) & 0xffffff00L;
}
inline Fix24& Fix24:: operator+=(const Fix24& f)
--- 355,361 ----
inline Fix24 operator>>(const Fix24& a, int b)
{
! return (a.m >> b) & (long)0xffffff00L;
}
inline Fix24& Fix24:: operator+=(const Fix24& f)
*** old-NetBSD/src/gnu/lib/libg++/libg++/Integer.cc
--- NetBSD/src/gnu/lib/libg++/libg++/Integer.cc
***************
*** 1882,1888 ****
long k = 0;
int l = (ul <= vl)? ul : vl;
int cont = 1;
! for (int i = 0; i < l && cont; ++i)
{
unsigned long a = (i < ul)? u->s[i] : 0;
unsigned long b = (i < vl)? v->s[i] : 0;
--- 1882,1889 ----
long k = 0;
int l = (ul <= vl)? ul : vl;
int cont = 1;
! int i;
! for (i = 0; i < l && cont; ++i)
{
unsigned long a = (i < ul)? u->s[i] : 0;
unsigned long b = (i < vl)? v->s[i] : 0;
*** old-NetBSD/src/gnu/lib/libg++/libg++/Obstack.cc
--- NetBSD/src/gnu/lib/libg++/libg++/Obstack.cc
***************
*** 85,91 ****
int Obstack::contains(void* obj) // true if obj somewhere in Obstack
{
! for (_obstack_chunk* ch = chunk;
ch != 0 && (obj < (void*)ch || obj >= (void*)(ch->limit));
ch = ch->prev);
--- 85,92 ----
int Obstack::contains(void* obj) // true if obj somewhere in Obstack
{
! _obstack_chunk* ch;
! for (ch = chunk;
ch != 0 && (obj < (void*)ch || obj >= (void*)(ch->limit));
ch = ch->prev);
*** old-NetBSD/src/gnu/lib/libg++/libg++/String.cc
--- NetBSD/src/gnu/lib/libg++/libg++/String.cc
***************
*** 965,971 ****
{
String sep = separator;
int xlen = 0;
! for (int i = 0; i < n; ++i)
xlen += src[i].length();
xlen += (n - 1) * sep.length();
--- 965,972 ----
{
String sep = separator;
int xlen = 0;
! int i;
! for (i = 0; i < n; ++i)
xlen += src[i].length();
xlen += (n - 1) * sep.length();
***************
*** 1117,1123 ****
const char* topx = &(xchars[x.length()]);
const char* ys = &(ychars[startpos]);
const char* topy = &(ychars[y.length()]);
! for (int l = 0; xs < topx && ys < topy && *xs++ == *ys++; ++l);
r.rep = Salloc(r.rep, ss, l, l);
}
--- 1118,1125 ----
const char* topx = &(xchars[x.length()]);
const char* ys = &(ychars[startpos]);
const char* topy = &(ychars[y.length()]);
! int l;
! for (l = 0; xs < topx && ys < topy && *xs++ == *ys++; ++l);
r.rep = Salloc(r.rep, ss, l, l);
}
***************
*** 1129,1135 ****
const char* botx = xchars;
const char* ys = &(ychars[y.length() + startpos]);
const char* boty = ychars;
! for (int l = 0; xs >= botx && ys >= boty && *xs == *ys ; --xs, --ys, ++l);
r.rep = Salloc(r.rep, ++xs, l, l);
}
--- 1131,1138 ----
const char* botx = xchars;
const char* ys = &(ychars[y.length() + startpos]);
const char* boty = ychars;
! int l;
! for (l = 0; xs >= botx && ys >= boty && *xs == *ys ; --xs, --ys, ++l);
r.rep = Salloc(r.rep, ++xs, l, l);
}
*** old-NetBSD/src/gnu/lib/libg++/libg++/dtoa.cc
--- NetBSD/src/gnu/lib/libg++/libg++/dtoa.cc
***************
*** 179,185 ****
if (ch > '5') // properly round: unavoidable propagation
{
int carry = 1;
! for (char* p = f - 1; p >= fwork && carry; --p)
{
++*p;
if (*p > '9')
--- 179,186 ----
if (ch > '5') // properly round: unavoidable propagation
{
int carry = 1;
! char *p;
! for (p = f - 1; p >= fwork && carry; --p)
{
++*p;
if (*p > '9')
***************
*** 313,319 ****
char* fmtbase = (char *) _libgxx_fmtq.alloc(fmtwidth + pad + 1);
char* fmt = fmtbase;
! for (int i = 0; i < pad; ++i) *fmt++ = ' ';
if (is_neg) *fmt++ = '-';
--- 314,321 ----
char* fmtbase = (char *) _libgxx_fmtq.alloc(fmtwidth + pad + 1);
char* fmt = fmtbase;
! int i;
! for (i = 0; i < pad; ++i) *fmt++ = ' ';
if (is_neg) *fmt++ = '-';
*** old-NetBSD/src/gnu/lib/libg++/libg++/error.cc
--- NetBSD/src/gnu/lib/libg++/libg++/error.cc
***************
*** 20,26 ****
#endif
#include <builtin.h>
! extern "C" _VOLATILE_VOID abort();
_VOLATILE_VOID default_one_arg_error_handler(const char* msg)
{
--- 20,26 ----
#endif
#include <builtin.h>
! extern "C" void abort();
_VOLATILE_VOID default_one_arg_error_handler(const char* msg)
{
*** /dev/null
--- NetBSD/src/gnu/usr.bin/groff/Makefile.inc
***************
*** 0 ****
--- 1,3 ----
+ # $NetBSD: Makefile.inc,v 1.1 1995/08/10 09:08:54 niklas Exp $
+
+ LINK= $(CXX)
*** old-NetBSD/src/gnu/usr.bin/groff/addftinfo/addftinfo.cc
--- NetBSD/src/gnu/usr.bin/groff/addftinfo/addftinfo.cc
***************
*** 34,40 ****
static void usage();
static void convert_font(const font_params &, FILE *, FILE *);
! typedef font_params::*param_t;
static struct {
const char *name;
--- 34,40 ----
static void usage();
static void convert_font(const font_params &, FILE *, FILE *);
! typedef int font_params::*param_t;
static struct {
const char *name;
***************
*** 89,102 ****
param.comma_depth = DEFAULT_COMMA_DEPTH;
param.desc_depth = DEFAULT_DESC_DEPTH;
param.body_depth = DEFAULT_BODY_DEPTH;
! for (int i = 1; i < argc && argv[i][0] == '-'; i++) {
if (argv[i][1] == '-' && argv[i][2] == '\0') {
i++;
break;
}
if (i + 1 >= argc)
usage();
! for (int j = 0;; j++) {
if (j >= sizeof(param_table)/sizeof(param_table[0]))
fatal("parameter `%1' not recognized", argv[i] + 1);
if (strcmp(param_table[j].name, argv[i] + 1) == 0)
--- 89,104 ----
param.comma_depth = DEFAULT_COMMA_DEPTH;
param.desc_depth = DEFAULT_DESC_DEPTH;
param.body_depth = DEFAULT_BODY_DEPTH;
! int i;
! for (i = 1; i < argc && argv[i][0] == '-'; i++) {
if (argv[i][1] == '-' && argv[i][2] == '\0') {
i++;
break;
}
if (i + 1 >= argc)
usage();
! int j;
! for (j = 0;; j++) {
if (j >= sizeof(param_table)/sizeof(param_table[0]))
fatal("parameter `%1' not recognized", argv[i] + 1);
if (strcmp(param_table[j].name, argv[i] + 1) == 0)
*** old-NetBSD/src/gnu/usr.bin/groff/eqn/delim.cc
--- NetBSD/src/gnu/usr.bin/groff/eqn/delim.cc
***************
*** 276,282 ****
printf(".ds " DELIM_STRING "\n");
delimiter *d = delim_table;
int delim_len = strlen(delim);
! for (int i = 0; i < DELIM_TABLE_SIZE; i++, d++)
if (strncmp(delim, d->name, delim_len) == 0
&& (left_or_right & d->flags) != 0)
break;
--- 276,283 ----
printf(".ds " DELIM_STRING "\n");
delimiter *d = delim_table;
int delim_len = strlen(delim);
! int i;
! for (i = 0; i < DELIM_TABLE_SIZE; i++, d++)
if (strncmp(delim, d->name, delim_len) == 0
&& (left_or_right & d->flags) != 0)
break;
*** old-NetBSD/src/gnu/usr.bin/groff/eqn/lex.cc
--- NetBSD/src/gnu/usr.bin/groff/eqn/lex.cc
***************
*** 251,257 ****
void init_table(const char *device)
{
! for (int i = 0; i < sizeof(token_table)/sizeof(token_table[0]); i++) {
definition *def = new definition;
def->is_macro = 0;
def->tok = token_table[i].token;
--- 251,258 ----
void init_table(const char *device)
{
! int i;
! for (i = 0; i < sizeof(token_table)/sizeof(token_table[0]); i++) {
definition *def = new definition;
def->is_macro = 0;
def->tok = token_table[i].token;
***************
*** 472,478 ****
char **av, input *x)
: input(x), argc(ac), ap(0)
{
! for (int i = 0; i < argc; i++)
argv[i] = av[i];
p = s = strsave(body);
int j = 0;
--- 473,480 ----
char **av, input *x)
: input(x), argc(ac), ap(0)
{
! int i;
! for (i = 0; i < argc; i++)
argv[i] = av[i];
p = s = strsave(body);
int j = 0;
***************
*** 687,693 ****
{
char *argv[9];
int argc = 0;
! for (int i = 0; i < 9; i++)
argv[i] = 0;
int level = 0;
int c;
--- 689,696 ----
{
char *argv[9];
int argc = 0;
! int i;
! for (i = 0; i < 9; i++)
argv[i] = 0;
int level = 0;
int c;
*** old-NetBSD/src/gnu/usr.bin/groff/eqn/list.cc
--- NetBSD/src/gnu/usr.bin/groff/eqn/list.cc
***************
*** 174,180 ****
void list_box::compute_sublist_width(int n)
{
int total_spacing = 0;
! for (int i = 1; i < n + 1 && i < list.len; i++)
total_spacing += compute_spacing(is_script, list.p[i-1]->spacing_type,
list.p[i]->spacing_type);
printf(".nr " TEMP_REG " %dM", total_spacing);
--- 174,181 ----
void list_box::compute_sublist_width(int n)
{
int total_spacing = 0;
! int i;
! for (i = 1; i < n + 1 && i < list.len; i++)
total_spacing += compute_spacing(is_script, list.p[i-1]->spacing_type,
list.p[i]->spacing_type);
printf(".nr " TEMP_REG " %dM", total_spacing);
*** old-NetBSD/src/gnu/usr.bin/groff/grodvi/dvi.cc
--- NetBSD/src/gnu/usr.bin/groff/grodvi/dvi.cc
***************
*** 305,311 ****
if (env->size != cur_point_size || f != cur_font) {
cur_font = f;
cur_point_size = env->size;
! for (int i = 0;; i++) {
if (i >= FONTS_MAX) {
fatal("too many output fonts required");
}
--- 305,312 ----
if (env->size != cur_point_size || f != cur_font) {
cur_font = f;
cur_point_size = env->size;
! int i;
! for (i = 0;; i++) {
if (i >= FONTS_MAX) {
fatal("too many output fonts required");
}
*** old-NetBSD/src/gnu/usr.bin/groff/groff/groff.cc
--- NetBSD/src/gnu/usr.bin/groff/groff/groff.cc
***************
*** 50,57 ****
}
#endif /* not STDLIB_H_DECLARES_PUTENV */
- const char *strsignal(int);
-
const int SOELIM_INDEX = 0;
const int REFER_INDEX = SOELIM_INDEX + 1;
const int PIC_INDEX = REFER_INDEX + 1;
--- 50,55 ----
***************
*** 281,287 ****
commands[TROFF_INDEX].append_arg("-T", device);
commands[EQN_INDEX].append_arg("-T", device);
! for (int first_index = 0; first_index < TROFF_INDEX; first_index++)
if (commands[first_index].get_name() != 0)
break;
if (optind < argc) {
--- 279,286 ----
commands[TROFF_INDEX].append_arg("-T", device);
commands[EQN_INDEX].append_arg("-T", device);
! int first_index;
! for (first_index = 0; first_index < TROFF_INDEX; first_index++)
if (commands[first_index].get_name() != 0)
break;
if (optind < argc) {
***************
*** 349,355 ****
void print_commands()
{
! for (int last = SPOOL_INDEX; last >= 0; last--)
if (commands[last].get_name() != 0)
break;
for (int i = 0; i <= last; i++)
--- 348,355 ----
void print_commands()
{
! int last;
! for (last = SPOOL_INDEX; last >= 0; last--)
if (commands[last].get_name() != 0)
break;
for (int i = 0; i <= last; i++)
***************
*** 463,469 ****
str += ' ';
int needs_quoting = 0;
int contains_single_quote = 0;
! for (const char *p = arg; *p != '\0'; p++)
switch (*p) {
case ';':
case '&':
--- 463,470 ----
str += ' ';
int needs_quoting = 0;
int contains_single_quote = 0;
! const char *p;
! for (p = arg; *p != '\0'; p++)
switch (*p) {
case ';':
case '&':
*** old-NetBSD/src/gnu/usr.bin/groff/grops/ps.cc
--- NetBSD/src/gnu/usr.bin/groff/grops/ps.cc
***************
*** 172,178 ****
ps_output &ps_output::put_string(const char *s, int n)
{
int len = 0;
! for (int i = 0; i < n; i++) {
char c = s[i];
if (isascii(c) && isprint(c)) {
if (c == '(' || c == ')' || c == '\\')
--- 172,179 ----
ps_output &ps_output::put_string(const char *s, int n)
{
int len = 0;
! int i;
! for (i = 0; i < n; i++) {
char c = s[i];
if (isascii(c) && isprint(c)) {
if (c == '(' || c == ')' || c == '\\')
***************
*** 646,652 ****
void ps_printer::define_encoding(const char *encoding, int encoding_index)
{
char *vec[256];
! for (int i = 0; i < 256; i++)
vec[i] = 0;
char *path;
FILE *fp = font::open_file(encoding, &path);
--- 647,654 ----
void ps_printer::define_encoding(const char *encoding, int encoding_index)
{
char *vec[256];
! int i;
! for (i = 0; i < 256; i++)
vec[i] = 0;
char *path;
FILE *fp = font::open_file(encoding, &path);
***************
*** 1193,1199 ****
"invis", &ps_printer::do_invis,
"endinvis", &ps_printer::do_endinvis,
};
! for (char *p = arg; *p == ' ' || *p == '\n'; p++)
;
char *tag = p;
for (; *p != '\0' && *p != ':' && *p != ' ' && *p != '\n'; p++)
--- 1195,1202 ----
"invis", &ps_printer::do_invis,
"endinvis", &ps_printer::do_endinvis,
};
! char *p;
! for (p = arg; *p == ' ' || *p == '\n'; p++)
;
char *tag = p;
for (; *p != '\0' && *p != ':' && *p != ' ' && *p != '\n'; p++)
***************
*** 1340,1346 ****
flush_sbuf();
while (*arg == ' ' || *arg == '\n')
arg++;
! for (char *p = arg; *p != '\0' && *p != ' ' && *p != '\n'; p++)
;
if (*p != '\0')
*p++ = '\0';
--- 1343,1350 ----
flush_sbuf();
while (*arg == ' ' || *arg == '\n')
arg++;
! char *p;
! for (p = arg; *p != '\0' && *p != ' ' && *p != '\n'; p++)
;
if (*p != '\0')
*p++ = '\0';
*** old-NetBSD/src/gnu/usr.bin/groff/grops/psrm.cc
--- NetBSD/src/gnu/usr.bin/groff/grops/psrm.cc
***************
*** 121,127 ****
string &version,
unsigned revision)
{
! for (resource *r = resource_list; r; r = r->next)
if (r->type == type
&& r->name == name
&& r->version == version
--- 121,128 ----
string &version,
unsigned revision)
{
! resource *r;
! for (r = resource_list; r; r = r->next)
if (r->type == type
&& r->name == name
&& r->version == version
***************
*** 137,143 ****
resource *resource_manager::lookup_font(const char *name)
{
! for (resource *r = resource_list; r; r = r->next)
if (r->type == RESOURCE_FONT
&& strlen(name) == r->name.length()
&& memcmp(name, r->name.contents(), r->name.length()) == 0)
--- 138,145 ----
resource *resource_manager::lookup_font(const char *name)
{
! resource *r;
! for (r = resource_list; r; r = r->next)
if (r->type == RESOURCE_FONT
&& strlen(name) == r->name.length()
&& memcmp(name, r->name.contents(), r->name.length()) == 0)
***************
*** 159,172 ****
void resource_manager::document_setup(ps_output &out)
{
int nranks = 0;
! for (resource *r = resource_list; r; r = r->next)
if (r->rank >= nranks)
nranks = r->rank + 1;
if (nranks > 0) {
// Sort resource_list in reverse order of rank.
Presource *head = new Presource[nranks + 1];
Presource **tail = new Presource *[nranks + 1];
! for (int i = 0; i < nranks + 1; i++) {
head[i] = 0;
tail[i] = &head[i];
}
--- 161,176 ----
void resource_manager::document_setup(ps_output &out)
{
int nranks = 0;
! resource *r;
! for (r = resource_list; r; r = r->next)
if (r->rank >= nranks)
nranks = r->rank + 1;
if (nranks > 0) {
// Sort resource_list in reverse order of rank.
Presource *head = new Presource[nranks + 1];
Presource **tail = new Presource *[nranks + 1];
! int i;
! for (i = 0; i < nranks + 1; i++) {
head[i] = 0;
tail[i] = &head[i];
}
***************
*** 510,516 ****
error("missing resource type");
return 0;
}
! for (int ri = 0; ri < NRESOURCES; ri++)
if (strlen(resource_table[ri]) == *ptr - name
&& memcmp(resource_table[ri], name, *ptr - name) == 0)
break;
--- 514,521 ----
error("missing resource type");
return 0;
}
! int ri;
! for (ri = 0; ri < NRESOURCES; ri++)
if (strlen(resource_table[ri]) == *ptr - name
&& memcmp(resource_table[ri], name, *ptr - name) == 0)
break;
***************
*** 833,839 ****
do {
++ptr;
} while (*ptr != '\0' && !white_space(*ptr));
! for (int i = 0; i < NEXTENSIONS; i++)
if (strlen(extension_table[i]) == ptr - name
&& memcmp(extension_table[i], name, ptr - name) == 0) {
flags |= (1 << i);
--- 838,845 ----
do {
++ptr;
} while (*ptr != '\0' && !white_space(*ptr));
! int i;
! for (i = 0; i < NEXTENSIONS; i++)
if (strlen(extension_table[i]) == ptr - name
&& memcmp(extension_table[i], name, ptr - name) == 0) {
flags |= (1 << i);
***************
*** 932,938 ****
if (buf[0] == '%') {
if (buf[1] == '%') {
const char *ptr;
! for (int i = 0; i < NCOMMENTS; i++)
if (ptr = matches_comment(buf, comment_table[i].name)) {
copy_this_line
= (this->*(comment_table[i].proc))(ptr, rank, fp, outfp);
--- 938,945 ----
if (buf[0] == '%') {
if (buf[1] == '%') {
const char *ptr;
! int i;
! for (i = 0; i < NCOMMENTS; i++)
if (ptr = matches_comment(buf, comment_table[i].name)) {
copy_this_line
= (this->*(comment_table[i].proc))(ptr, rank, fp, outfp);
***************
*** 1028,1034 ****
return;
}
int level = 0;
! for (int i = 0; i < len; i++)
if (str[i] == '(')
level++;
else if (str[i] == ')' && --level < 0)
--- 1035,1042 ----
return;
}
int level = 0;
! int i;
! for (i = 0; i < len; i++)
if (str[i] == '(')
level++;
else if (str[i] == ')' && --level < 0)
*** old-NetBSD/src/gnu/usr.bin/groff/grotty/tty.cc
--- NetBSD/src/gnu/usr.bin/groff/grotty/tty.cc
***************
*** 218,224 ****
// characters before normal characters at each hpos, and otherwise
// in order of occurrence.
! for (glyph **pp = lines + (vpos - 1); *pp; pp = &(*pp)->next)
if (int((*pp)->hpos) < hpos
|| ((*pp)->hpos == hpos && (*pp)->draw_mode() >= g->draw_mode()))
break;
--- 218,225 ----
// characters before normal characters at each hpos, and otherwise
// in order of occurrence.
! glyph **pp;
! for (pp = lines + (vpos - 1); *pp; pp = &(*pp)->next)
if (int((*pp)->hpos) < hpos
|| ((*pp)->hpos == hpos && (*pp)->draw_mode() >= g->draw_mode()))
break;
***************
*** 270,276 ****
if (page_length % font::vert != 0)
error("vertical position at end of page not multiple of vertical resolution");
int lines_per_page = page_length / font::vert;
! for (int last_line = nlines; last_line > 0; last_line--)
if (lines[last_line - 1])
break;
#if 0
--- 271,278 ----
if (page_length % font::vert != 0)
error("vertical position at end of page not multiple of vertical resolution");
int lines_per_page = page_length / font::vert;
! int last_line;
! for (last_line = nlines; last_line > 0; last_line--)
if (lines[last_line - 1])
break;
#if 0
*** old-NetBSD/src/gnu/usr.bin/groff/include/ptable.h
--- NetBSD/src/gnu/usr.bin/groff/include/ptable.h
***************
*** 96,102 ****
{ \
assert(key != 0); \
unsigned long h = hash_string(key); \
! for (unsigned n = unsigned(h % size); \
v[n].key != 0; \
n = (n == 0 ? size - 1 : n - 1)) \
if (strcmp(v[n].key, key) == 0) { \
--- 96,103 ----
{ \
assert(key != 0); \
unsigned long h = hash_string(key); \
! unsigned n; \
! for (n = unsigned(h % size); \
v[n].key != 0; \
n = (n == 0 ? size - 1 : n - 1)) \
if (strcmp(v[n].key, key) == 0) { \
***************
*** 116,122 ****
if (oldv[i].val == 0) \
a_delete oldv[i].key; \
else { \
! for (unsigned j = unsigned(hash_string(oldv[i].key) % size); \
v[j].key != 0; \
j = (j == 0 ? size - 1 : j - 1)) \
; \
--- 117,124 ----
if (oldv[i].val == 0) \
a_delete oldv[i].key; \
else { \
! unsigned j; \
! for (j = unsigned(hash_string(oldv[i].key) % size); \
v[j].key != 0; \
j = (j == 0 ? size - 1 : j - 1)) \
; \
*** old-NetBSD/src/gnu/usr.bin/groff/indxbib/indxbib.cc
--- NetBSD/src/gnu/usr.bin/groff/indxbib/indxbib.cc
***************
*** 242,248 ****
string path;
int lineno = 1;
for (;;) {
! for (int c = getc(fp); c != '\n' && c != EOF; c = getc(fp)) {
if (c == '\0')
error_with_file_and_line(foption, lineno,
"nul character in pathname ignored");
--- 242,249 ----
string path;
int lineno = 1;
for (;;) {
! int c;
! for (c = getc(fp); c != '\n' && c != EOF; c = getc(fp)) {
if (c == '\0')
error_with_file_and_line(foption, lineno,
"nul character in pathname ignored");
*** old-NetBSD/src/gnu/usr.bin/groff/libbib/index.cc
--- NetBSD/src/gnu/usr.bin/groff/libbib/index.cc
***************
*** 506,512 ****
return first_list;
if (*second_list < 0)
return second_list;
! for (const int *p = first_list; *p >= 0; p++)
;
int len = p - first_list;
for (p = second_list; *p >= 0; p++)
--- 506,513 ----
return first_list;
if (*second_list < 0)
return second_list;
! const int *p;
! for (p = first_list; *p >= 0; p++)
;
int len = p - first_list;
for (p = second_list; *p >= 0; p++)
***************
*** 586,592 ****
void index_search_item::add_out_of_date_file(int fd, const char *filename,
int fid)
{
! for (search_item **pp = &out_of_date_files; *pp; pp = &(*pp)->next)
if ((*pp)->is_named(filename))
return;
*pp = make_linear_search_item(fd, filename, fid);
--- 587,594 ----
void index_search_item::add_out_of_date_file(int fd, const char *filename,
int fid)
{
! search_item **pp;
! for (pp = &out_of_date_files; *pp; pp = &(*pp)->next)
if ((*pp)->is_named(filename))
return;
*pp = make_linear_search_item(fd, filename, fid);
*** old-NetBSD/src/gnu/usr.bin/groff/libbib/linear.cc
--- NetBSD/src/gnu/usr.bin/groff/libbib/linear.cc
***************
*** 58,64 ****
map_init::map_init()
{
! for (int i = 0; i < 256; i++)
map[i] = csalnum(i) ? cmlower(i) : '\0';
for (i = 0; i < 256; i++) {
if (cslower(i)) {
--- 58,65 ----
map_init::map_init()
{
! int i;
! for (i = 0; i < 256; i++)
map[i] = csalnum(i) ? cmlower(i) : '\0';
for (i = 0; i < 256; i++) {
if (cslower(i)) {
***************
*** 175,181 ****
if (*p++ == '\n') {
if (p == end || *p == '%')
break;
! for (const char *q = p; *q == ' ' || *q == '\t'; q++)
;
if (*q == '\n')
break;
--- 176,183 ----
if (*p++ == '\n') {
if (p == end || *p == '%')
break;
! const char *q;
! for (q = p; *q == ' ' || *q == '\t'; q++)
;
if (*q == '\n')
break;
***************
*** 190,196 ****
if (*p++ == '\n') {
if (p == bufend)
break;
! for (const char *q = p; *q == ' ' || *q == '\t'; q++)
;
if (*q == '\n')
break;
--- 192,199 ----
if (*p++ == '\n') {
if (p == bufend)
break;
! const char *q;
! for (q = p; *q == ' ' || *q == '\t'; q++)
;
if (*q == '\n')
break;
***************
*** 262,268 ****
*start = p + 1;
return 1;
}
! for (const char *q = p - 1; *q == ' ' || *q == '\t'; q--)
;
if (*q == '\n') {
if (start)
--- 265,272 ----
*start = p + 1;
return 1;
}
! const char *q;
! for (q = p - 1; *q == ' ' || *q == '\t'; q--)
;
if (*q == '\n') {
if (start)
***************
*** 392,398 ****
if (!found)
break;
const char *refend = find_end(bufend, found + keys[0]->length());
! for (int i = 1; i < nkeys; i++)
if (!search_and_check(keys[i], refstart, refend))
break;
if (i >= nkeys) {
--- 396,403 ----
if (!found)
break;
const char *refend = find_end(bufend, found + keys[0]->length());
! int i;
! for (i = 1; i < nkeys; i++)
if (!search_and_check(keys[i], refstart, refend))
break;
if (i >= nkeys) {
*** old-NetBSD/src/gnu/usr.bin/groff/libbib/search.cc
--- NetBSD/src/gnu/usr.bin/groff/libbib/search.cc
***************
*** 62,68 ****
p = make_linear_search_item(fd, filename, next_fid);
}
if (p) {
! for (search_item **pp = &list; *pp; pp = &(*pp)->next)
;
*pp = p;
next_fid = p->next_filename_id();
--- 62,69 ----
p = make_linear_search_item(fd, filename, next_fid);
}
if (p) {
! search_item **pp;
! for (pp = &list; *pp; pp = &(*pp)->next)
;
*pp = p;
next_fid = p->next_filename_id();
*** old-NetBSD/src/gnu/usr.bin/groff/libdriver/input.cc
--- NetBSD/src/gnu/usr.bin/groff/libdriver/input.cc
***************
*** 268,274 ****
int n;
int *p = 0;
int szp = 0;
! for (int np = 0; possibly_get_integer(&n); np++) {
if (np >= szp) {
if (szp == 0) {
szp = 16;
--- 268,275 ----
int n;
int *p = 0;
int szp = 0;
! int np;
! for (np = 0; possibly_get_integer(&n); np++) {
if (np >= szp) {
if (szp == 0) {
szp = 16;
***************
*** 290,296 ****
env.hpos += p[0];
}
else {
! for (int i = 0; i < np/2; i++) {
env.hpos += p[i*2];
env.vpos += p[i*2 + 1];
}
--- 291,298 ----
env.hpos += p[0];
}
else {
! int i;
! for (i = 0; i < np/2; i++) {
env.hpos += p[i*2];
env.vpos += p[i*2 + 1];
}
*** old-NetBSD/src/gnu/usr.bin/groff/libdriver/printer.cc
--- NetBSD/src/gnu/usr.bin/groff/libdriver/printer.cc
***************
*** 64,70 ****
if (n >= nfonts)
nfonts = n + 1;
font_table = new font *[nfonts];
! for (int i = 0; i < old_nfonts; i++)
font_table[i] = old_font_table[i];
for (i = old_nfonts; i < nfonts; i++)
font_table[i] = 0;
--- 64,71 ----
if (n >= nfonts)
nfonts = n + 1;
font_table = new font *[nfonts];
! int i;
! for (i = 0; i < old_nfonts; i++)
font_table[i] = old_font_table[i];
for (i = old_nfonts; i < nfonts; i++)
font_table[i] = 0;
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/font.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/font.cc
***************
*** 246,252 ****
if (!widths_cache)
widths_cache = new font_widths_cache(point_size, ch_size);
else if (widths_cache->point_size != point_size) {
! for (font_widths_cache **p = &widths_cache; *p; p = &(*p)->next)
if ((*p)->point_size == point_size)
break;
if (*p) {
--- 246,253 ----
if (!widths_cache)
widths_cache = new font_widths_cache(point_size, ch_size);
else if (widths_cache->point_size != point_size) {
! font_widths_cache **p;
! for (p = &widths_cache; *p; p = &(*p)->next)
if ((*p)->point_size == point_size)
break;
if (*p) {
***************
*** 398,404 ****
void font::compact()
{
! for (int i = nindices - 1; i >= 0; i--)
if (ch_index[i] >= 0)
break;
i++;
--- 399,406 ----
void font::compact()
{
! int i;
! for (i = nindices - 1; i >= 0; i--)
if (ch_index[i] >= 0)
break;
i++;
***************
*** 728,734 ****
while (t.next()) {
char *p = strtok(t.buf, WS);
int found = 0;
! for (int i = 0; !found && i < sizeof(table)/sizeof(table[0]); i++)
if (strcmp(table[i].command, p) == 0)
found = 1;
if (found) {
--- 730,737 ----
while (t.next()) {
char *p = strtok(t.buf, WS);
int found = 0;
! int i;
! for (i = 0; !found && i < sizeof(table)/sizeof(table[0]); i++)
if (strcmp(table[i].command, p) == 0)
found = 1;
if (found) {
***************
*** 830,836 ****
else if (strcmp("styles", p) == 0) {
int style_table_size = 5;
style_table = (const char **)new char *[style_table_size];
! for (int j = 0; j < style_table_size; j++)
style_table[j] = 0;
int i = 0;
for (;;) {
--- 833,840 ----
else if (strcmp("styles", p) == 0) {
int style_table_size = 5;
style_table = (const char **)new char *[style_table_size];
! int j;
! for (j = 0; j < style_table_size; j++)
style_table[j] = 0;
int i = 0;
for (;;) {
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/lf.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/lf.cc
***************
*** 45,51 ****
change_lineno(ln);
return 1;
}
! for (const char *q = p;
*q != '\0' && *q != ' ' && *q != '\n' && *q != '\\';
q++)
;
--- 45,52 ----
change_lineno(ln);
return 1;
}
! const char *q;
! for (q = p;
*q != '\0' && *q != ' ' && *q != '\n' && *q != '\\';
q++)
;
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/nametoindex.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/nametoindex.cc
***************
*** 51,57 ****
character_indexer::character_indexer()
: next_index(0)
{
! for (int i = 0; i < 256; i++)
ascii_index[i] = -1;
for (i = 0; i < NSMALL; i++)
small_number_index[i] = -1;
--- 51,58 ----
character_indexer::character_indexer()
: next_index(0)
{
! int i;
! for (i = 0; i < 256; i++)
ascii_index[i] = -1;
for (i = 0; i < NSMALL; i++)
small_number_index[i] = -1;
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/ptable.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/ptable.cc
***************
*** 44,50 ****
unsigned next_ptable_size(unsigned n)
{
! for (const unsigned *p = table_sizes; *p <= n; p++)
if (*p == 0)
fatal("cannot expand table");
return *p;
--- 44,51 ----
unsigned next_ptable_size(unsigned n)
{
! const unsigned *p;
! for (p = table_sizes; *p <= n; p++)
if (*p == 0)
fatal("cannot expand table");
return *p;
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/string.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/string.cc
***************
*** 281,287 ****
char *p = ptr;
int n = len;
int nnuls = 0;
! for (int i = 0; i < n; i++)
if (p[i] == '\0')
nnuls++;
char *q = new char[n + 1 - nnuls];
--- 281,288 ----
char *p = ptr;
int n = len;
int nnuls = 0;
! int i;
! for (i = 0; i < n; i++)
if (p[i] == '\0')
nnuls++;
char *q = new char[n + 1 - nnuls];
*** old-NetBSD/src/gnu/usr.bin/groff/lkbib/lkbib.cc
--- NetBSD/src/gnu/usr.bin/groff/lkbib/lkbib.cc
***************
*** 96,102 ****
if (list.nfiles() == 0)
fatal("no databases");
int total_len = 0;
! for (int i = optind; i < argc; i++)
total_len += strlen(argv[i]);
total_len += argc - optind - 1 + 1; // for spaces and '\0'
char *buffer = new char[total_len];
--- 96,103 ----
if (list.nfiles() == 0)
fatal("no databases");
int total_len = 0;
! int i;
! for (i = optind; i < argc; i++)
total_len += strlen(argv[i]);
total_len += argc - optind - 1 + 1; // for spaces and '\0'
char *buffer = new char[total_len];
***************
*** 110,116 ****
search_list_iterator iter(&list, buffer);
const char *start;
int len;
! for (int count = 0; iter.next(&start, &len); count++) {
if (fwrite(start, 1, len, stdout) != len)
fatal("write error on stdout: %1", strerror(errno));
// Can happen for last reference in file.
--- 111,118 ----
search_list_iterator iter(&list, buffer);
const char *start;
int len;
! int count;
! for (count = 0; iter.next(&start, &len); count++) {
if (fwrite(start, 1, len, stdout) != len)
fatal("write error on stdout: %1", strerror(errno));
// Can happen for last reference in file.
*** old-NetBSD/src/gnu/usr.bin/groff/lookbib/lookbib.cc
--- NetBSD/src/gnu/usr.bin/groff/lookbib/lookbib.cc
***************
*** 106,112 ****
search_list_iterator iter(&list, line);
const char *start;
int len;
! for (int count = 0; iter.next(&start, &len); count++) {
if (fwrite(start, 1, len, stdout) != len)
fatal("write error on stdout: %1", strerror(errno));
// Can happen for last reference in file.
--- 106,113 ----
search_list_iterator iter(&list, line);
const char *start;
int len;
! int count;
! for (count = 0; iter.next(&start, &len); count++) {
if (fwrite(start, 1, len, stdout) != len)
fatal("write error on stdout: %1", strerror(errno));
// Can happen for last reference in file.
*** old-NetBSD/src/gnu/usr.bin/groff/pic/lex.cc
--- NetBSD/src/gnu/usr.bin/groff/pic/lex.cc
***************
*** 361,367 ****
{
char *argv[9];
int argc = 0;
! for (int i = 0; i < 9; i++)
argv[i] = 0;
int level = 0;
int c;
--- 361,368 ----
{
char *argv[9];
int argc = 0;
! int i;
! for (i = 0; i < 9; i++)
argv[i] = 0;
int level = 0;
int c;
*** old-NetBSD/src/gnu/usr.bin/groff/pic/object.cc
--- NetBSD/src/gnu/usr.bin/groff/pic/object.cc
***************
*** 512,518 ****
void object_list::wrap_up_block(object_list *ol)
{
! for (object *p = tail; p && p->type() != MARK_OBJECT; p = p->prev)
;
assert(p != 0);
ol->head = p->next;
--- 512,519 ----
void object_list::wrap_up_block(object_list *ol)
{
! object *p;
! for (p = tail; p && p->type() != MARK_OBJECT; p = p->prev)
;
assert(p != 0);
ol->head = p->next;
***************
*** 595,601 ****
{
aligned = a;
int len = 0;
! for (text_item *p = t; p; p = p->next)
len++;
if (len == 0)
text = 0;
--- 596,603 ----
{
aligned = a;
int len = 0;
! text_item *p;
! for (p = t; p; p = p->next)
len++;
if (len == 0)
text = 0;
***************
*** 1341,1347 ****
// Absolutise all movements
position endpos = startpos;
int nsegments = 0;
! for (segment *s = segment_list; s; s = s->next, nsegments++)
if (s->is_absolute)
endpos = s->pos;
else {
--- 1343,1350 ----
// Absolutise all movements
position endpos = startpos;
int nsegments = 0;
! segment *s;
! for (s = segment_list; s; s = s->next, nsegments++)
if (s->is_absolute)
endpos = s->pos;
else {
***************
*** 1767,1773 ****
void path::append(char *s)
{
! for (string_list **p = &label_list; *p; p = &(*p)->next)
;
*p = new string_list(s);
}
--- 1770,1777 ----
void path::append(char *s)
{
! string_list **p;
! for (p = &label_list; *p; p = &(*p)->next)
;
*p = new string_list(s);
}
*** old-NetBSD/src/gnu/usr.bin/groff/pic/pic.y
--- NetBSD/src/gnu/usr.bin/groff/pic/pic.y
***************
*** 940,946 ****
| object_spec text %prec TEXT
{
$$ = $1;
! for (text_item **p = & $$->text; *p; p = &(*p)->next)
;
*p = new text_item($2.str, $2.filename, $2.lineno);
}
--- 940,947 ----
| object_spec text %prec TEXT
{
$$ = $1;
! text_item **p;
! for (p = & $$->text; *p; p = &(*p)->next)
;
*p = new text_item($2.str, $2.filename, $2.lineno);
}
***************
*** 948,954 ****
{
$$ = $1;
if ($$->text) {
! for (text_item *p = $$->text; p->next; p = p->next)
;
p->adj.h = LEFT_ADJUST;
}
--- 949,956 ----
{
$$ = $1;
if ($$->text) {
! text_item *p;
! for (p = $$->text; p->next; p = p->next)
;
p->adj.h = LEFT_ADJUST;
}
***************
*** 957,963 ****
{
$$ = $1;
if ($$->text) {
! for (text_item *p = $$->text; p->next; p = p->next)
;
p->adj.h = RIGHT_ADJUST;
}
--- 959,966 ----
{
$$ = $1;
if ($$->text) {
! text_item *p;
! for (p = $$->text; p->next; p = p->next)
;
p->adj.h = RIGHT_ADJUST;
}
***************
*** 966,972 ****
{
$$ = $1;
if ($$->text) {
! for (text_item *p = $$->text; p->next; p = p->next)
;
p->adj.v = ABOVE_ADJUST;
}
--- 969,976 ----
{
$$ = $1;
if ($$->text) {
! text_item *p;
! for (p = $$->text; p->next; p = p->next)
;
p->adj.v = ABOVE_ADJUST;
}
***************
*** 975,980 ****
--- 979,985 ----
{
$$ = $1;
if ($$->text) {
+ text_item *p;
for (text_item *p = $$->text; p->next; p = p->next)
;
p->adj.v = BELOW_ADJUST;
***************
*** 1162,1168 ****
ordinal object_type
{
int count = 0;
! for (object *p = olist.head; p != 0; p = p->next)
if (p->type() == $2 && ++count == $1) {
$$ = p;
break;
--- 1167,1174 ----
ordinal object_type
{
int count = 0;
! object *p;
! for (p = olist.head; p != 0; p = p->next)
if (p->type() == $2 && ++count == $1) {
$$ = p;
break;
***************
*** 1176,1182 ****
| optional_ordinal_last object_type
{
int count = 0;
! for (object *p = olist.tail; p != 0; p = p->prev)
if (p->type() == $2 && ++count == $1) {
$$ = p;
break;
--- 1182,1189 ----
| optional_ordinal_last object_type
{
int count = 0;
! object *p;
! for (p = olist.tail; p != 0; p = p->prev)
if (p->type() == $2 && ++count == $1) {
$$ = p;
break;
*** old-NetBSD/src/gnu/usr.bin/groff/refer/label.y
--- NetBSD/src/gnu/usr.bin/groff/refer/label.y
***************
*** 872,878 ****
if (v[0]->get_number() != num + 1
|| v[1]->get_number() != num + 2)
return 0;
! for (int i = 2; i < n; i++)
if (v[i]->get_number() != num + i + 1)
break;
result = get_label(type);
--- 872,879 ----
if (v[0]->get_number() != num + 1
|| v[1]->get_number() != num + 2)
return 0;
! int i;
! for (i = 2; i < n; i++)
if (v[i]->get_number() != num + i + 1)
break;
result = get_label(type);
***************
*** 945,951 ****
label_table[i] = 0;
}
unsigned h = hash_string(label.contents(), label.length()) % label_table_size;
! for (label_info **ptr = label_table + h;
*ptr != 0;
(ptr == label_table)
? (ptr = label_table + label_table_size - 1)
--- 946,953 ----
label_table[i] = 0;
}
unsigned h = hash_string(label.contents(), label.length()) % label_table_size;
! label_info **ptr;
! for (ptr = label_table + h;
*ptr != 0;
(ptr == label_table)
? (ptr = label_table + label_table_size - 1)
***************
*** 970,976 ****
if (old_table[i]) {
unsigned h = hash_string(label_pool.contents() + old_table[i]->start,
old_table[i]->length);
! for (label_info **p = label_table + (h % label_table_size);
*p != 0;
(p == label_table)
? (p = label_table + label_table_size - 1)
--- 972,979 ----
if (old_table[i]) {
unsigned h = hash_string(label_pool.contents() + old_table[i]->start,
old_table[i]->length);
! label_info **p;
! for (p = label_table + (h % label_table_size);
*p != 0;
(p == label_table)
? (p = label_table + label_table_size - 1)
***************
*** 1165,1171 ****
{
if (nauthors < 0) {
const char *dummy;
! for (int na = 0; get_author(na, &dummy) != 0; na++)
;
((reference *)this)->nauthors = na;
}
--- 1168,1175 ----
{
if (nauthors < 0) {
const char *dummy;
! int na;
! for (na = 0; get_author(na, &dummy) != 0; na++)
;
((reference *)this)->nauthors = na;
}
*** old-NetBSD/src/gnu/usr.bin/groff/refer/ref.cc
--- NetBSD/src/gnu/usr.bin/groff/refer/ref.cc
***************
*** 54,60 ****
: no(-1), field(0), nfields(0), h(0), merged(0), label_ptr(0),
computed_authors(0), last_needed_author(-1), nauthors(-1)
{
! for (int i = 0; i < 256; i++)
field_index[i] = NULL_FIELD_INDEX;
if (ridp)
rid = *ridp;
--- 54,61 ----
: no(-1), field(0), nfields(0), h(0), merged(0), label_ptr(0),
computed_authors(0), last_needed_author(-1), nauthors(-1)
{
! int i;
! for (i = 0; i < 256; i++)
field_index[i] = NULL_FIELD_INDEX;
if (ridp)
rid = *ridp;
***************
*** 199,205 ****
string *old_field = field;
field = new string[nfields + 1];
int pos = 0;
! for (int i = 0; i < int(c); i++)
if (field_index[i] != NULL_FIELD_INDEX)
pos++;
for (i = 0; i < pos; i++)
--- 200,207 ----
string *old_field = field;
field = new string[nfields + 1];
int pos = 0;
! int i;
! for (i = 0; i < int(c); i++)
if (field_index[i] != NULL_FIELD_INDEX)
pos++;
for (i = 0; i < pos; i++)
***************
*** 222,228 ****
return;
string *old_field = field;
field = new string[nfields - 1];
! for (int i = 0; i < int(field_index[c]); i++)
field[i].move(old_field[i]);
for (i = field_index[c]; i < nfields - 1; i++)
field[i].move(old_field[i + 1]);
--- 224,231 ----
return;
string *old_field = field;
field = new string[nfields - 1];
! int i;
! for (i = 0; i < int(field_index[c]); i++)
field[i].move(old_field[i]);
for (i = field_index[c]; i < nfields - 1; i++)
field[i].move(old_field[i + 1]);
***************
*** 330,336 ****
a < ae;
a = strchr(a, '\0') + 1)
if (first_word_len == strlen(a)) {
! for (int j = 0; j < first_word_len; j++)
if (a[j] != cmlower(s[j]))
break;
if (j >= first_word_len) {
--- 333,340 ----
a < ae;
a = strchr(a, '\0') + 1)
if (first_word_len == strlen(a)) {
! int j;
! for (j = 0; j < first_word_len; j++)
if (a[j] != cmlower(s[j]))
break;
if (j >= first_word_len) {
***************
*** 395,401 ****
{
const char *end = s + len;
for (;;) {
! for (const char *ptr = s;
ptr < end && *ptr != SORT_SUB_SEP && *ptr != SORT_SUB_SUB_SEP;
ptr++)
;
--- 399,406 ----
{
const char *end = s + len;
for (;;) {
! const char *ptr;
! for (ptr = s;
ptr < end && *ptr != SORT_SUB_SEP && *ptr != SORT_SUB_SUB_SEP;
ptr++)
;
***************
*** 692,698 ****
const char *ptr = f.contents();
int len = f.length();
int nfield_seps = 0;
! for (int j = 0; j < len; j++)
if (ptr[j] == FIELD_SEPARATOR)
nfield_seps++;
if (nfield_seps == 0)
--- 697,704 ----
const char *ptr = f.contents();
int len = f.length();
int nfield_seps = 0;
! int j;
! for (j = 0; j < len; j++)
if (ptr[j] == FIELD_SEPARATOR)
nfield_seps++;
if (nfield_seps == 0)
*** old-NetBSD/src/gnu/usr.bin/groff/refer/refer.cc
--- NetBSD/src/gnu/usr.bin/groff/refer/refer.cc
***************
*** 179,185 ****
num = opt;
opt = 0;
}
! for (const char *ptr = num; *ptr; ptr++)
if (!csdigit(*ptr)) {
error("bad character `%1' in argument to -f option", *ptr);
break;
--- 179,186 ----
num = opt;
opt = 0;
}
! const char *ptr;
! for (ptr = num; *ptr; ptr++)
if (!csdigit(*ptr)) {
error("bad character `%1' in argument to -f option", *ptr);
break;
***************
*** 227,233 ****
break;
case 'a':
{
! for (const char *ptr = ++opt; *ptr; ptr++)
if (!csdigit(*ptr)) {
error("argument to `a' option not a number");
break;
--- 228,235 ----
break;
case 'a':
{
! const char *ptr;
! for (ptr = ++opt; *ptr; ptr++)
if (!csdigit(*ptr)) {
error("argument to `a' option not a number");
break;
***************
*** 697,703 ****
reference *ref = make_reference(str, &flags);
ref->compute_hash_code();
unsigned h = ref->hash();
! for (reference **ptr = reference_hash_table + (h % hash_table_size);
*ptr != 0;
((ptr == reference_hash_table)
? (ptr = reference_hash_table + hash_table_size - 1)
--- 699,706 ----
reference *ref = make_reference(str, &flags);
ref->compute_hash_code();
unsigned h = ref->hash();
! reference **ptr;
! for (ptr = reference_hash_table + (h % hash_table_size);
*ptr != 0;
((ptr == reference_hash_table)
? (ptr = reference_hash_table + hash_table_size - 1)
***************
*** 727,733 ****
reference_hash_table[i] = 0;
for (i = 0; i < old_size; i++)
if (old_table[i]) {
! for (reference **p = (reference_hash_table
+ (old_table[i]->hash() % hash_table_size));
*p;
((p == reference_hash_table)
--- 730,737 ----
reference_hash_table[i] = 0;
for (i = 0; i < old_size; i++)
if (old_table[i]) {
! reference **p;
! for (p = (reference_hash_table
+ (old_table[i]->hash() % hash_table_size));
*p;
((p == reference_hash_table)
***************
*** 785,791 ****
for (int i = 1; i < n; i++) {
int num = v[i]->get_number();
reference *temp = v[i];
! for (int j = i - 1; j >= 0 && v[j]->get_number() > num; j--)
v[j + 1] = v[j];
v[j + 1] = temp;
}
--- 789,796 ----
for (int i = 1; i < n; i++) {
int num = v[i]->get_number();
reference *temp = v[i];
! int j;
! for (j = i - 1; j >= 0 && v[j]->get_number() > num; j--)
v[j + 1] = v[j];
v[j + 1] = temp;
}
***************
*** 1213,1219 ****
16000057, 32000011, 64000031, 128000003, 0
};
! for (const int *p = table_sizes; *p <= n && *p != 0; p++)
;
assert(*p != 0);
return *p;
--- 1218,1225 ----
16000057, 32000011, 64000031, 128000003, 0
};
! const int *p;
! for (p = table_sizes; *p <= n && *p != 0; p++)
;
assert(*p != 0);
return *p;
*** old-NetBSD/src/gnu/usr.bin/groff/refer/token.cc
--- NetBSD/src/gnu/usr.bin/groff/refer/token.cc
***************
*** 190,196 ****
static void init_ascii()
{
! for (const char *p = "abcdefghijklmnopqrstuvwxyz"; *p; p++) {
char buf[2];
buf[0] = *p;
buf[1] = '\0';
--- 190,197 ----
static void init_ascii()
{
! const char *p;
! for (p = "abcdefghijklmnopqrstuvwxyz"; *p; p++) {
char buf[2];
buf[0] = *p;
buf[1] = '\0';
***************
*** 296,302 ****
static void init_special_chars()
{
! for (const char *p = "':^`~"; *p; p++)
for (const char *q = "aeiouy"; *q; q++) {
// Use a variable to work around bug in gcc 2.0
char c = cmupper(*q);
--- 297,304 ----
static void init_special_chars()
{
! const char *p;
! for (p = "':^`~"; *p; p++)
for (const char *q = "aeiouy"; *q; q++) {
// Use a variable to work around bug in gcc 2.0
char c = cmupper(*q);
*** old-NetBSD/src/gnu/usr.bin/groff/tbl/main.cc
--- NetBSD/src/gnu/usr.bin/groff/tbl/main.cc
***************
*** 690,696 ****
void input_entry_format::debug_print()
{
! for (int i = 0; i < pre_vline; i++)
putc('|', stderr);
entry_format::debug_print();
if (!width.empty()) {
--- 690,697 ----
void input_entry_format::debug_print()
{
! int i;
! for (i = 0; i < pre_vline; i++)
putc('|', stderr);
entry_format::debug_print();
if (!width.empty()) {
***************
*** 1393,1399 ****
}
// Do this here rather than at the beginning in case continued formats
// change it.
! for (int i = 0; i < ncolumns - 1; i++)
if (f->separation[i] >= 0)
tbl->set_column_separation(i, f->separation[i]);
for (i = 0; i < ncolumns; i++)
--- 1394,1401 ----
}
// Do this here rather than at the beginning in case continued formats
// change it.
! int i;
! for (i = 0; i < ncolumns - 1; i++)
if (f->separation[i] >= 0)
tbl->set_column_separation(i, f->separation[i]);
for (i = 0; i < ncolumns; i++)
*** old-NetBSD/src/gnu/usr.bin/groff/tbl/table.cc
--- NetBSD/src/gnu/usr.bin/groff/tbl/table.cc
***************
*** 663,669 ****
prints(".if \\n[" SAVED_FILL_REG "] .fi\n"
".in 0\n");
prints(".ll ");
! for (int i = start_col; i <= end_col; i++)
if (mw[i].empty())
break;
if (i > end_col) {
--- 663,670 ----
prints(".if \\n[" SAVED_FILL_REG "] .fi\n"
".in 0\n");
prints(".ll ");
! int i;
! for (i = start_col; i <= end_col; i++)
if (mw[i].empty())
break;
if (i > end_col) {
***************
*** 1274,1280 ****
void table::add_stuff(stuff *p)
{
! for (stuff **pp = &stuff_list; *pp; pp = &(*pp)->next)
;
*pp = p;
}
--- 1275,1282 ----
void table::add_stuff(stuff *p)
{
! stuff **pp;
! for (pp = &stuff_list; *pp; pp = &(*pp)->next)
;
*pp = p;
}
***************
*** 1324,1330 ****
assert(allocated_rows > r);
while (nrows <= r) {
entry[nrows] = new table_entry*[ncolumns];
! for (int i = 0; i < ncolumns; i++)
entry[nrows][i] = 0;
vline[nrows] = new char[ncolumns+1];
for (i = 0; i < ncolumns+1; i++)
--- 1326,1333 ----
assert(allocated_rows > r);
while (nrows <= r) {
entry[nrows] = new table_entry*[ncolumns];
! int i;
! for (i = 0; i < ncolumns; i++)
entry[nrows][i] = 0;
vline[nrows] = new char[ncolumns+1];
for (i = 0; i < ncolumns+1; i++)
***************
*** 1590,1596 ****
e->input_filename = fn;
e->start_row = e->end_row = r;
e->start_col = e->end_col = c;
! for (table_entry **p = &entry_list; *p; p = &(*p)->next)
;
*p = e;
entry[r][c] = e;
--- 1593,1600 ----
e->input_filename = fn;
e->start_row = e->end_row = r;
e->start_col = e->end_col = c;
! table_entry **p;
! for (p = &entry_list; *p; p = &(*p)->next)
;
*p = e;
entry[r][c] = e;
***************
*** 1924,1930 ****
printfs(".nr " NEEDED_REG " \\n[%1]-(\\n[%2]",
span_width_reg(start_col, end_col),
span_width_reg(start_col, start_col));
! for (int i = start_col + 1; i <= end_col; i++) {
// The column separation may shrink with the expand option.
if (!(flags & EXPAND))
printfs("+%1n", as_string(column_separation[i - 1]));
--- 1928,1935 ----
printfs(".nr " NEEDED_REG " \\n[%1]-(\\n[%2]",
span_width_reg(start_col, end_col),
span_width_reg(start_col, start_col));
! int i;
! for (i = start_col + 1; i <= end_col; i++) {
// The column separation may shrink with the expand option.
if (!(flags & EXPAND))
printfs("+%1n", as_string(column_separation[i - 1]));
***************
*** 1975,1981 ****
table_entry *p = entry_list;
while (p) {
if (p->end_col != p->start_col) {
! for (horizontal_span *q = span_list; q; q = q->next)
if (q->start_col == p->start_col
&& q->end_col == p->end_col)
break;
--- 1980,1987 ----
table_entry *p = entry_list;
while (p) {
if (p->end_col != p->start_col) {
! horizontal_span *q;
! for (q = span_list; q; q = q->next)
if (q->start_col == p->start_col
&& q->end_col == p->end_col)
break;
***************
*** 1990,1996 ****
horizontal_span *unsorted = span_list;
span_list = 0;
while (unsorted) {
! for (horizontal_span **pp = &span_list; *pp; pp = &(*pp)->next)
if (unsorted->end_col < (*pp)->end_col
|| (unsorted->end_col == (*pp)->end_col
&& (unsorted->start_col > (*pp)->start_col)))
--- 1996,2003 ----
horizontal_span *unsorted = span_list;
span_list = 0;
while (unsorted) {
! horizontal_span **pp;
! for (pp = &span_list; *pp; pp = &(*pp)->next)
if (unsorted->end_col < (*pp)->end_col
|| (unsorted->end_col == (*pp)->end_col
&& (unsorted->start_col > (*pp)->start_col)))
***************
*** 2017,2022 ****
--- 2024,2030 ----
}
if (flags & EXPAND) {
int total_sep = left_separation + right_separation;
+ int i;
for (int i = 0; i < ncolumns - 1; i++)
total_sep += column_separation[i];
if (total_sep != 0) {
***************
*** 2035,2041 ****
printfs(".nr %1 %2*\\n[" SEPARATION_FACTOR_REG "]\n",
column_start_reg(0),
as_string(left_separation));
! for (int i = 1;; i++) {
printfs(".nr %1 \\n[%2]+\\n[%3]\n",
column_end_reg(i-1),
column_start_reg(i-1),
--- 2043,2050 ----
printfs(".nr %1 %2*\\n[" SEPARATION_FACTOR_REG "]\n",
column_start_reg(0),
as_string(left_separation));
! int i;
! for (i = 1;; i++) {
printfs(".nr %1 \\n[%2]+\\n[%3]\n",
column_end_reg(i-1),
column_start_reg(i-1),
***************
*** 2066,2072 ****
void table::make_columns_equal()
{
int first = -1; // index of first equal column
! for (int i = 0; i < ncolumns; i++)
if (equal[i]) {
if (first < 0) {
printfs(".nr %1 \\n[%1]", span_width_reg(i, i));
--- 2075,2082 ----
void table::make_columns_equal()
{
int first = -1; // index of first equal column
! int i;
! for (i = 0; i < ncolumns; i++)
if (equal[i]) {
if (first < 0) {
printfs(".nr %1 \\n[%1]", span_width_reg(i, i));
***************
*** 2149,2155 ****
&& entry[r][start_col] != 0
&& entry[r][start_col]->start_row != r)
start_col++;
! for (int end_col = start_col;
end_col < ncolumns
&& (entry[r][end_col] == 0
|| entry[r][end_col]->start_row == r);
--- 2159,2166 ----
&& entry[r][start_col] != 0
&& entry[r][start_col]->start_row != r)
start_col++;
! int end_col;
! for (end_col = start_col;
end_col < ncolumns
&& (entry[r][end_col] == 0
|| entry[r][end_col]->start_row == r);
***************
*** 2197,2203 ****
&& entry[r][start_col] != 0
&& entry[r][start_col]->start_row != r)
start_col++;
! for (int end_col = start_col;
end_col < ncolumns
&& (entry[r][end_col] == 0
|| entry[r][end_col]->start_row == r);
--- 2208,2215 ----
&& entry[r][start_col] != 0
&& entry[r][start_col]->start_row != r)
start_col++;
! int end_col;
! for (end_col = start_col;
end_col < ncolumns
&& (entry[r][end_col] == 0
|| entry[r][end_col]->start_row == r);
***************
*** 2305,2311 ****
result = "";
}
else {
! for (stuff *p = stuff_list; p && p->row < end_row + 1; p = p->next)
;
if (p && p->row == end_row + 1 && p->is_double_line()) {
result = "-" DOUBLE_LINE_SEP;
--- 2317,2324 ----
result = "";
}
else {
! stuff *p;
! for (p = stuff_list; p && p->row < end_row + 1; p = p->next)
;
if (p && p->row == end_row + 1 && p->is_double_line()) {
result = "-" DOUBLE_LINE_SEP;
***************
*** 2399,2405 ****
&& (end_row == nrows - 1
|| vline[end_row+1][col] != vline[end_row][col]
|| vline_spanned(end_row+1, col))) {
! for (int start_row = end_row - 1;
start_row >= 0
&& vline[start_row][col] == vline[end_row][col]
&& !vline_spanned(start_row, col);
--- 2412,2419 ----
&& (end_row == nrows - 1
|| vline[end_row+1][col] != vline[end_row][col]
|| vline_spanned(end_row+1, col))) {
! int start_row;
! for (start_row = end_row - 1;
start_row >= 0
&& vline[start_row][col] == vline[end_row][col]
&& !vline_spanned(start_row, col);
***************
*** 2498,2504 ****
if (!(flags & NOKEEP) && row_begins_section(r))
prints("." KEEP_MACRO_NAME "\n");
int had_line = 0;
! for (stuff *p = stuff_list; p && p->row < r; p = p->next)
;
for (stuff *p1 = p; p1 && p1->row == r; p1 = p1->next)
if (!p1->printed && (p1->is_single_line() || p1->is_double_line())) {
--- 2512,2519 ----
if (!(flags & NOKEEP) && row_begins_section(r))
prints("." KEEP_MACRO_NAME "\n");
int had_line = 0;
! stuff *p;
! for (p = stuff_list; p && p->row < r; p = p->next)
;
for (stuff *p1 = p; p1 && p1->row == r; p1 = p1->next)
if (!p1->printed && (p1->is_single_line() || p1->is_double_line())) {
*** old-NetBSD/src/gnu/usr.bin/groff/tfmtodit/tfmtodit.cc
--- NetBSD/src/gnu/usr.bin/groff/tfmtodit/tfmtodit.cc
***************
*** 825,831 ****
m[4] = g.get_left_adjustment(i);
m[5] = g.get_right_adjustment(i);
printf("%s\t%d", p->ch, m[0]*MULTIPLIER);
! for (int j = int(sizeof(m)/sizeof(m[0])) - 1; j > 0; j--)
if (m[j] != 0)
break;
for (int k = 1; k <= j; k++)
--- 825,832 ----
m[4] = g.get_left_adjustment(i);
m[5] = g.get_right_adjustment(i);
printf("%s\t%d", p->ch, m[0]*MULTIPLIER);
! int j;
! for (j = int(sizeof(m)/sizeof(m[0])) - 1; j > 0; j--)
if (m[j] != 0)
break;
for (int k = 1; k <= j; k++)
*** old-NetBSD/src/gnu/usr.bin/groff/troff/dictionary.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/dictionary.cc
***************
*** 28,34 ****
static int is_good_size(int p)
{
const int SMALL = 10;
! for (unsigned i = 2; i <= p/2; i++)
if (p % i == 0)
return 0;
for (i = 0x100; i != 0; i <<= 8)
--- 28,35 ----
static int is_good_size(int p)
{
const int SMALL = 10;
! unsigned i;
! for (i = 2; i <= p/2; i++)
if (p % i == 0)
return 0;
for (i = 0x100; i != 0; i <<= 8)
***************
*** 49,55 ****
void *dictionary::lookup(symbol s, void *v)
{
! for (int i = int(s.hash() % size);
table[i].v != 0;
i == 0 ? i = size - 1: --i)
if (s == table[i].s) {
--- 50,57 ----
void *dictionary::lookup(symbol s, void *v)
{
! int i;
! for (i = int(s.hash() % size);
table[i].v != 0;
i == 0 ? i = size - 1: --i)
if (s == table[i].s) {
***************
*** 96,102 ****
void *dictionary::remove(symbol s)
{
// this relies on the fact that we are using linear probing
! for (int i = int(s.hash() % size);
table[i].v != 0 && s != table[i].s;
i == 0 ? i = size - 1: --i)
;
--- 98,105 ----
void *dictionary::remove(symbol s)
{
// this relies on the fact that we are using linear probing
! int i;
! for (i = int(s.hash() % size);
table[i].v != 0 && s != table[i].s;
i == 0 ? i = size - 1: --i)
;
*** old-NetBSD/src/gnu/usr.bin/groff/troff/div.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/div.cc
***************
*** 446,452 ****
void top_level_diversion::add_trap(symbol nm, vunits pos)
{
trap *first_free_slot = 0;
! for (trap **p = &page_trap_list; *p; p = &(*p)->next) {
if ((*p)->nm.is_null()) {
if (first_free_slot == 0)
first_free_slot = *p;
--- 446,453 ----
void top_level_diversion::add_trap(symbol nm, vunits pos)
{
trap *first_free_slot = 0;
! trap **p;
! for (p = &page_trap_list; *p; p = &(*p)->next) {
if ((*p)->nm.is_null()) {
if (first_free_slot == 0)
first_free_slot = *p;
*** old-NetBSD/src/gnu/usr.bin/groff/troff/div.h
--- NetBSD/src/gnu/usr.bin/groff/troff/div.h
***************
*** 145,148 ****
void handle_first_page_transition();
void blank_line();
! extern void cleanup_and_exit(int);
--- 145,154 ----
void handle_first_page_transition();
void blank_line();
! #ifdef __GNUG__
! #define NO_RETURN volatile
! #else
! #define NO_RETURN
! #endif
!
! extern NO_RETURN void cleanup_and_exit(int);
*** old-NetBSD/src/gnu/usr.bin/groff/troff/env.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/env.cc
***************
*** 136,142 ****
)
curdiv->output(nd, no_fill, vs, ls, width);
else {
! for (pending_output_line **p = &pending_lines; *p; p = &(*p)->next)
;
*p = new pending_output_line(nd, no_fill, vs, ls, width);
}
--- 136,143 ----
)
curdiv->output(nd, no_fill, vs, ls, width);
else {
! pending_output_line **p;
! for (p = &pending_lines; *p; p = &(*p)->next)
;
*p = new pending_output_line(nd, no_fill, vs, ls, width);
}
***************
*** 1586,1592 ****
if (line == 0)
return;
hyphenation_type prev_type = line->get_hyphenation_type();
! for (node **startp = &line->next; *startp != 0; startp = &(*startp)->next) {
hyphenation_type this_type = (*startp)->get_hyphenation_type();
if (prev_type == HYPHEN_BOUNDARY && this_type == HYPHEN_MIDDLE)
break;
--- 1587,1594 ----
if (line == 0)
return;
hyphenation_type prev_type = line->get_hyphenation_type();
! node **startp;
! for (startp = &line->next; *startp != 0; startp = &(*startp)->next) {
hyphenation_type this_type = (*startp)->get_hyphenation_type();
if (prev_type == HYPHEN_BOUNDARY && this_type == HYPHEN_MIDDLE)
break;
***************
*** 1705,1711 ****
space_total = 0;
width_total = 0;
node *first_non_discardable = 0;
! for (node *tem = line; tem != 0; tem = tem->next)
if (!tem->discardable())
first_non_discardable = tem;
node *to_be_discarded;
--- 1707,1714 ----
space_total = 0;
width_total = 0;
node *first_non_discardable = 0;
! node *tem;
! for (tem = line; tem != 0; tem = tem->next)
if (!tem->discardable())
first_non_discardable = tem;
node *to_be_discarded;
***************
*** 2025,2031 ****
tab_type tab_stops::distance_to_next_tab(hunits curpos, hunits *distance)
{
hunits lastpos = 0;
! for (tab *tem = initial_list; tem && tem->pos <= curpos; tem = tem->next)
lastpos = tem->pos;
if (tem) {
*distance = tem->pos - curpos;
--- 2028,2035 ----
tab_type tab_stops::distance_to_next_tab(hunits curpos, hunits *distance)
{
hunits lastpos = 0;
! tab *tem;
! for (tem = initial_list; tem && tem->pos <= curpos; tem = tem->next)
lastpos = tem->pos;
if (tem) {
*distance = tem->pos - curpos;
***************
*** 2053,2059 ****
static int buf_size = 0;
// figure out a maximum on the amount of space we can need
int count = 0;
! for (tab *p = initial_list; p; p = p->next)
++count;
for (p = repeated_list; p; p = p->next)
++count;
--- 2057,2064 ----
static int buf_size = 0;
// figure out a maximum on the amount of space we can need
int count = 0;
! tab *p;
! for (p = initial_list; p; p = p->next)
++count;
for (p = repeated_list; p; p = p->next)
++count;
***************
*** 2149,2155 ****
void tab_stops::add_tab(hunits pos, tab_type type, int repeated)
{
! for (tab **p = repeated ? &repeated_list : &initial_list; *p; p = &(*p)->next)
;
*p = new tab(pos, type);
}
--- 2154,2161 ----
void tab_stops::add_tab(hunits pos, tab_type type, int repeated)
{
! tab **p;
! for (p = repeated ? &repeated_list : &initial_list; *p; p = &(*p)->next)
;
*p = new tab(pos, type);
}
***************
*** 2282,2288 ****
field_spaces += tab_field_spaces;
}
if (tab_contents != 0) {
! for (node *tem = tab_contents; tem->next != 0; tem = tem->next)
;
tem->next = line;
line = tab_contents;
--- 2288,2295 ----
field_spaces += tab_field_spaces;
}
if (tab_contents != 0) {
! node *tem;
! for (tem = tab_contents; tem->next != 0; tem = tem->next)
;
tem->next = line;
line = tab_contents;
***************
*** 2390,2396 ****
current_tab = TAB_NONE;
}
if (tab_contents != 0) {
! for (node *tem = tab_contents; tem->next != 0; tem = tem->next)
;
tem->next = line;
line = tab_contents;
--- 2397,2404 ----
current_tab = TAB_NONE;
}
if (tab_contents != 0) {
! node *tem;
! for (tem = tab_contents; tem->next != 0; tem = tem->next)
;
tem->next = line;
line = tab_contents;
***************
*** 2901,2907 ****
void hyphen_trie::hyphenate(const char *word, int len, int *hyphens)
{
! for (int j = 0; j < len+1; j++)
hyphens[j] = 0;
for (j = 0; j < len - 1; j++) {
h = hyphens + j;
--- 2909,2916 ----
void hyphen_trie::hyphenate(const char *word, int len, int *hyphens)
{
! int j;
! for (j = 0; j < len+1; j++)
hyphens[j] = 0;
for (j = 0; j < len - 1; j++) {
h = hyphens + j;
***************
*** 2986,2992 ****
int len = 0;
char hbuf[WORD_MAX+2];
char *buf = hbuf + 1;
! for (hyphen_list *tem = h; tem && len < WORD_MAX; tem = tem->next) {
if (tem->hyphenation_code != 0)
buf[len++] = tem->hyphenation_code;
else
--- 2995,3002 ----
int len = 0;
char hbuf[WORD_MAX+2];
char *buf = hbuf + 1;
! hyphen_list *tem;
! for (tem = h; tem && len < WORD_MAX; tem = tem->next) {
if (tem->hyphenation_code != 0)
buf[len++] = tem->hyphenation_code;
else
*** old-NetBSD/src/gnu/usr.bin/groff/troff/input.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/input.cc
***************
*** 513,519 ****
void input_stack::next_file(FILE *fp, const char *s)
{
! for (input_iterator **pp = ⊤ *pp != &nil_iterator; pp = &(*pp)->next)
if ((*pp)->next_file(fp, s))
return;
if (++level > limit && limit > 0)
--- 513,520 ----
void input_stack::next_file(FILE *fp, const char *s)
{
! input_iterator **pp;
! for (pp = ⊤ *pp != &nil_iterator; pp = &(*pp)->next)
if ((*pp)->next_file(fp, s))
return;
if (++level > limit && limit > 0)
***************
*** 1400,1406 ****
symbol s = read_escape_name();
if (s.is_null())
break;
! for (const char *p = s.contents(); *p != '\0'; p++)
if (!csdigit(*p))
break;
if (*p)
--- 1401,1408 ----
symbol s = read_escape_name();
if (s.is_null())
break;
! const char *p;
! for (p = s.contents(); *p != '\0'; p++)
if (!csdigit(*p))
break;
if (*p)
***************
*** 2730,2736 ****
void macro_iterator::add_arg(const macro &m)
{
! for (arg_list **p = &args; *p; p = &((*p)->next))
;
*p = new arg_list(m);
++argc;
--- 2732,2739 ----
void macro_iterator::add_arg(const macro &m)
{
! arg_list **p;
! for (p = &args; *p; p = &((*p)->next))
;
*p = new arg_list(m);
++argc;
***************
*** 3107,3113 ****
}
}
else {
! for (const char *p = s; *p && csdigit(*p); p++)
;
if (*p)
error("bad argument name `%1'", s);
--- 3110,3117 ----
}
}
else {
! const char *p;
! for (p = s; *p && csdigit(*p); p++)
;
if (*p)
error("bad argument name `%1'", s);
***************
*** 3245,3251 ****
const char *s = term.contents();
int d;
// see if it matches term
! for (int i = 0; s[i] != 0; i++) {
d = get_copy(&n);
if ((unsigned char)s[i] != d)
break;
--- 3249,3256 ----
const char *s = term.contents();
int d;
// see if it matches term
! int i;
! for (i = 0; s[i] != 0; i++) {
d = get_copy(&n);
if ((unsigned char)s[i] != d)
break;
*** old-NetBSD/src/gnu/usr.bin/groff/troff/node.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/node.cc
***************
*** 610,616 ****
next = tfont_list;
tfont_list = this;
tfont_spec plain_spec = plain();
! for (tfont *p = tfont_list; p; p = p->next)
if (*p == plain_spec) {
plain_version = p;
break;
--- 610,617 ----
next = tfont_list;
tfont_list = this;
tfont_spec plain_spec = plain();
! tfont *p;
! for (p = tfont_list; p; p = p->next)
if (*p == plain_spec) {
plain_version = p;
break;
***************
*** 2374,2380 ****
hunits w = n->width();
if (w > max_width)
max_width = w;
! for (node **p = &list; *p; p = &(*p)->next)
;
n->next = 0;
*p = n;
--- 2375,2382 ----
hunits w = n->width();
if (w > max_width)
max_width = w;
! node **p;
! for (p = &list; *p; p = &(*p)->next)
;
n->next = 0;
*p = n;
***************
*** 2968,2974 ****
if (pre == 0)
*prep = next;
else {
! for (node *tem = pre; tem->next != 0; tem = tem->next)
;
tem->next = next;
*prep = pre;
--- 2970,2977 ----
if (pre == 0)
*prep = next;
else {
! node *tem;
! for (tem = pre; tem->next != 0; tem = tem->next)
;
tem->next = next;
*prep = pre;
***************
*** 3519,3525 ****
if (list == 0)
return;
int npieces = 0;
! for (node *tem = list; tem; tem = tem->next)
++npieces;
vunits h = list->size();
vunits totalh = h*npieces;
--- 3522,3529 ----
if (list == 0)
return;
int npieces = 0;
! node *tem;
! for (tem = list; tem; tem = tem->next)
++npieces;
vunits h = list->size();
vunits totalh = h*npieces;
***************
*** 4552,4558 ****
int next_available_font_position()
{
! for (int i = 1; i < font_table_size && font_table[i] != 0; i++)
;
return i;
}
--- 4556,4563 ----
int next_available_font_position()
{
! int i;
! for (i = 1; i < font_table_size && font_table[i] != 0; i++)
;
return i;
}
*** old-NetBSD/src/gnu/usr.bin/groff/troff/symbol.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/symbol.cc
***************
*** 82,88 ****
table_used = 0;
}
unsigned int hc = hash_string(p);
! for (const char **pp = table + hc % table_size;
*pp != 0;
(pp == table ? pp = table + table_size - 1 : --pp))
if (strcmp(p, *pp) == 0) {
--- 82,89 ----
table_used = 0;
}
unsigned int hc = hash_string(p);
! const char **pp;
! for (pp = table + hc % table_size;
*pp != 0;
(pp == table ? pp = table + table_size - 1 : --pp))
if (strcmp(p, *pp) == 0) {
***************
*** 96,102 ****
if (table_used >= table_size - 1 || table_used >= table_size*FULL_MAX) {
const char **old_table = table;
unsigned int old_table_size = table_size;
! for (int i = 1; table_sizes[i] <= old_table_size; i++)
if (table_sizes[i] == 0)
fatal("too many symbols");
table_size = table_sizes[i];
--- 97,104 ----
if (table_used >= table_size - 1 || table_used >= table_size*FULL_MAX) {
const char **old_table = table;
unsigned int old_table_size = table_size;
! int i;
! for (i = 1; table_sizes[i] <= old_table_size; i++)
if (table_sizes[i] == 0)
fatal("too many symbols");
table_size = table_sizes[i];
*** old-NetBSD/src/gnu/usr.bin/rcs/rcsdiff/rcsdiff.c
--- NetBSD/src/gnu/usr.bin/rcs/rcsdiff/rcsdiff.c
***************
*** 208,215 ****
/* fall into */
case 'C': case 'F': case 'I': case 'L': case 'W':
#if DIFF_L
! if (c == 'L' && ++file_labels == 2)
faterror("too many -L options");
#endif
*dcp++ = c;
if (*a)
--- 208,216 ----
/* fall into */
case 'C': case 'F': case 'I': case 'L': case 'W':
#if DIFF_L
! if (c == 'L' && file_labels++ == 2)
faterror("too many -L options");
+ /* fall into */
#endif
*dcp++ = c;
if (*a)
*** old-NetBSD/src/share/mk/bsd.prog.mk
--- NetBSD/src/share/mk/bsd.prog.mk
***************
*** 20,25 ****
--- 20,26 ----
LIBDES?= ${DESTDIR}/usr/lib/libdes.a
LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a
LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a
+ LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a
LIBL?= ${DESTDIR}/usr/lib/libl.a
LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a
LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a
***************
*** 66,77 ****
.if defined(DESTDIR)
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc
.else
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
.endif # defined(DESTDIR)
.endif # defined(OBJS) && !empty(OBJS)
--- 67,78 ----
.if defined(DESTDIR)
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! ${LINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc
.else
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! ${LINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
.endif # defined(DESTDIR)
.endif # defined(OBJS) && !empty(OBJS)
*** old-NetBSD/src/share/mk/sys.mk
--- NetBSD/src/share/mk/sys.mk
***************
*** 50,55 ****
--- 50,57 ----
LD= ld
LDFLAGS=
+ LINK= $(CC)
+
LINT= lint
LINTFLAGS= -chapbx
*** old-NetBSD/src/sys/arch/amiga/Makefile
--- NetBSD/src/sys/arch/amiga/Makefile
***************
*** 3,13 ****
# @(#)Makefile 7.3 (Berkeley) 6/9/91
S=${BSDSRCDIR}/sys
! COMM= $S/vm/*.[ch] $S/ufs/*.[ch] $S/sys/*.h $S/compat/sunos/*.[ch] \
$S/nfs/*.[ch] $S/netns/*.[ch] $S/netiso/*.[ch] \
$S/netiso/xebec/*.[ch] $S/netinet/*.[ch] $S/netccitt/*.[ch] \
$S/net/*.[ch] $S/miscfs/*/*.[ch] $S/kern/*.[ch] $S/dev/*.[ch] \
! $S/scsi/*.[ch] $S/lib/libkern/m68k/*.[ch] $S/lib/libkern/*.[ch]
# Makefile for amiga tags file
--- 3,14 ----
# @(#)Makefile 7.3 (Berkeley) 6/9/91
S=${BSDSRCDIR}/sys
! COMM= $S/vm/*.[ch] $S/ufs/*/*.[ch] $S/sys/*.h $S/compat/sunos/*.[ch] \
$S/nfs/*.[ch] $S/netns/*.[ch] $S/netiso/*.[ch] \
$S/netiso/xebec/*.[ch] $S/netinet/*.[ch] $S/netccitt/*.[ch] \
$S/net/*.[ch] $S/miscfs/*/*.[ch] $S/kern/*.[ch] $S/dev/*.[ch] \
! $S/dev/isa/*.[ch] \
! $S/scsi/*.[ch] $S/lib/libkern/arch/m68k/*.[ch] $S/lib/libkern/*.[ch]
# Makefile for amiga tags file
***************
*** 17,33 ****
TAMIGA= $S/arch/amiga/tags
SAMIGA= $S/arch/m68k/m68k/*.c $S/arch/m68k/include/*.h \
$S/arch/amiga/amiga/*.[ch] $S/arch/amiga/include/*.h \
! $S/arch/amiga/dev/*.[ch]
AAMIGA= $S/arch/m68k/m68k/*.s $S/arch/amiga/amiga/*.s
# Directories in which to place amiga tags links
! DAMIGA= amiga dev include
TAGS:
-etags -dt ${COMM} ${SAMIGA} ${AAMIGA}
! egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AAMIGA} | \
! sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
! >> ${TAMIGA}/tags
tags:
-ctags -dtf ${TAMIGA} ${COMM} ${SAMIGA}
--- 18,34 ----
TAMIGA= $S/arch/amiga/tags
SAMIGA= $S/arch/m68k/m68k/*.c $S/arch/m68k/include/*.h \
$S/arch/amiga/amiga/*.[ch] $S/arch/amiga/include/*.h \
! $S/arch/amiga/dev/*.[ch] $S/arch/amiga/isa/*.[ch]
AAMIGA= $S/arch/m68k/m68k/*.s $S/arch/amiga/amiga/*.s
# Directories in which to place amiga tags links
! DAMIGA= amiga dev include isa
TAGS:
-etags -dt ${COMM} ${SAMIGA} ${AAMIGA}
! # egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AAMIGA} | \
! # sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
! # >> ${TAMIGA}/tags
tags:
-ctags -dtf ${TAMIGA} ${COMM} ${SAMIGA}
*** old-NetBSD/src/sys/arch/amiga/amiga/amiga_init.c
--- NetBSD/src/sys/arch/amiga/amiga/amiga_init.c
***************
*** 79,89 ****
*/
vm_offset_t INTREQRaddr;
vm_offset_t INTREQWaddr;
!
! /*
! * these are used by the extended spl?() macros.
! */
! volatile unsigned short *amiga_intena_read, *amiga_intena_write;
/*
* the number of pages in our hw mapping and the start address
--- 79,86 ----
*/
vm_offset_t INTREQRaddr;
vm_offset_t INTREQWaddr;
! vm_offset_t INTENARaddr;
! vm_offset_t INTENAWaddr;
/*
* the number of pages in our hw mapping and the start address
***************
*** 99,104 ****
--- 96,103 ----
static u_long boot_flags;
+ void rollcolor __P((int));
+
void *
chipmem_steal(amount)
long amount;
***************
*** 172,177 ****
--- 171,180 ----
u_int tc, end_loaded, ncd, i;
u_int *sg, *pg, *pg2;
+ #ifdef BOOT_DEBUG
+ rollcolor(0x008);
+ #endif
+
boot_fphystart = fphystart;
boot_fphysize = fphysize;
boot_cphysize = cphysize;
***************
*** 232,237 ****
--- 235,244 ----
}
}
+ #ifdef BOOT_DEBUG
+ rollcolor(0x080);
+ #endif
+
/*
* Scan ConfigDev list and get size of Zorro I/O boards that are
* outside the Zorro II I/O area.
***************
*** 470,476 ****
}
/*
! *[ following page tables MAY be allocated to ZORRO3 space,
* but they're then later mapped in autoconf.c ]
*/
--- 477,483 ----
}
/*
! *[ following page tables MAY be allocated to ZORRO2 or ZORRO3 space,
* but they're then later mapped in autoconf.c ]
*/
***************
*** 492,497 ****
--- 499,508 ----
lowram = fphystart >> PGSHIFT;
physmem = fphysize >> PGSHIFT;
+ #ifdef BOOT_DEBUG
+ rollcolor(0x800);
+ #endif
+
/*
* get the pmap module in sync with reality.
*/
***************
*** 582,587 ****
--- 593,600 ----
CUSTOMbase = CUSTOMADDR;
INTREQRaddr = (vm_offset_t)&custom.intreqr;
INTREQWaddr = (vm_offset_t)&custom.intreq;
+ INTENARaddr = (vm_offset_t)&custom.intenar;
+ INTENAWaddr = (vm_offset_t)&custom.intena;
/*
* Get our chip memory allocation system working
***************
*** 597,604 ****
i = *(int *)proc0paddr;
*(volatile int *)proc0paddr = i;
/*
! * disable all interupts but enable allow them to be enabled
* by specific driver code (global int enable bit)
*/
custom.intena = 0x7fff; /* disable ints */
--- 610,621 ----
i = *(int *)proc0paddr;
*(volatile int *)proc0paddr = i;
+ #ifdef BOOT_DEBUG
+ rollcolor(0x088);
+ #endif
+
/*
! * disable all interupts but allow them to be enabled
* by specific driver code (global int enable bit)
*/
custom.intena = 0x7fff; /* disable ints */
***************
*** 608,620 ****
ciab.icr = 0x7f; /* and again */
/*
- * remember address of read and write intena register for use
- * by extended spl?() macros.
- */
- amiga_intena_read = &custom.intenar;
- amiga_intena_write = &custom.intena;
-
- /*
* This is needed for 3000's with superkick ROM's. Bit 7 of
* 0xde0002 enables the ROM if set. If this isn't set the machine
* has to be powercycled in order for it to boot again. ICKA! RFH
--- 625,630 ----
***************
*** 637,643 ****
{
int s, i;
! s = splhigh();
/*
* need to adjust count -
* too slow when cache off, too fast when cache on
--- 647,653 ----
{
int s, i;
! s = spl7();
/*
* need to adjust count -
* too slow when cache off, too fast when cache on
*** old-NetBSD/src/sys/arch/amiga/amiga/cc.c
--- NetBSD/src/sys/arch/amiga/amiga/cc.c
***************
*** 323,334 ****
*/
struct audio_channel {
! u_short play_count;
};
/* - channel[4] */
/* the data for each audio channel and what to do with it. */
! static struct audio_channel channel[4];
/* audio vbl node for vbl function */
struct vbl_node audio_vbl_node;
--- 323,335 ----
*/
struct audio_channel {
! u_short play_count; /* number of times to loop sample */
! handler_func_t handler; /* interupt handler for channel */
};
/* - channel[4] */
/* the data for each audio channel and what to do with it. */
! struct audio_channel channel[4];
/* audio vbl node for vbl function */
struct vbl_node audio_vbl_node;
***************
*** 337,342 ****
--- 338,344 ----
cc_init_audio()
{
int i;
+ extern int defchannel_handler();
/*
* disable all audio interupts
***************
*** 346,353 ****
/*
* initialize audio channels to off.
*/
! for (i=0; i < 4; i++)
channel[i].play_count = 0;
}
--- 348,357 ----
/*
* initialize audio channels to off.
*/
! for (i=0; i < 4; i++) {
channel[i].play_count = 0;
+ channel[i].handler = defchannel_handler;
+ }
}
***************
*** 393,414 ****
if ((ir & (flag << 7)) == 0)
continue;
! if (channel[i].play_count)
! channel[i].play_count--;
! else {
! /*
! * disable DMA to this channel and
! * disable interrupts to this channel
! */
! custom.dmacon = flag;
! custom.intena = (flag << 7);
! }
/*
* clear this channels interrupt.
*/
custom.intreq = (flag << 7);
}
-
out:
/*
* enable audio interupts with dma still set.
--- 397,410 ----
if ((ir & (flag << 7)) == 0)
continue;
! if (channel[i].handler)
! channel[i].handler(i);
!
/*
* clear this channels interrupt.
*/
custom.intreq = (flag << 7);
}
out:
/*
* enable audio interupts with dma still set.
***************
*** 418,423 ****
--- 414,439 ----
custom.intena = INTF_SETCLR | (audio_dma << 7);
}
+ /*
+ * this is the channel handler used by the system
+ * other software modules are free to install their own
+ * handler
+ */
+ defchannel_handler(i)
+ int i;
+ {
+ if (channel[i].play_count)
+ channel[i].play_count--;
+ else {
+ /*
+ * disable DMA to this channel and
+ * disable interrupts to this channel
+ */
+ custom.dmacon = (1 << i);
+ custom.intena = (1 << (i + 7));
+ }
+ }
+
void
play_sample(len, data, period, volume, channels, count)
u_short len, *data, period, volume, channels;
***************
*** 430,442 ****
/* load the channels */
for (ch = 0; ch < 4; ch++) {
! if ((dmabits & (ch << ch)) == 0)
continue;
! custom.aud[ch].len = len;
! custom.aud[ch].lc = data;
custom.aud[ch].per = period;
custom.aud[ch].vol = volume;
! channel[ch].play_count = count;
}
/*
* turn on interrupts and enable dma for channels and
--- 446,461 ----
/* load the channels */
for (ch = 0; ch < 4; ch++) {
! if ((dmabits & (1 << ch)) == 0)
continue;
! /* busy */
! if (channel[ch].handler != defchannel_handler)
! continue;
! channel[ch].play_count = count;
custom.aud[ch].per = period;
custom.aud[ch].vol = volume;
! custom.aud[ch].len = len;
! custom.aud[ch].lc = data;
}
/*
* turn on interrupts and enable dma for channels and
*** old-NetBSD/src/sys/arch/amiga/amiga/cc.h
--- NetBSD/src/sys/arch/amiga/amiga/cc.h
***************
*** 147,152 ****
--- 147,154 ----
#define CHIPMEMTOP (0x00200000)
#define NCHIPMEMPG btoc(CHIPMEMTOP - CHIPMEMBASE)
+ typedef int (*handler_func_t)();
+
/*
* Prototypes.
*/
*** old-NetBSD/src/sys/arch/amiga/amiga/conf.c
--- NetBSD/src/sys/arch/amiga/amiga/conf.c
***************
*** 94,99 ****
--- 94,109 ----
};
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
+ #if 0
+ /* ioctl */
+ #define cdev_aconf_init(c,n) { \
+ (dev_type_open((*))) nullop, (dev_type_close((*))) nullop, \
+ (dev_type_read((*))) nullop, (dev_type_write((*))) nullop, \
+ dev_init(c,aconf,ioctl), (dev_type_stop((*))) enodev, 0, seltrue, \
+ (dev_type_map((*))) enodev, 0 \
+ }
+ #endif
+
/* open, close, ioctl, select, mmap -- XXX should be a map device */
#define cdev_grf_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
***************
*** 114,119 ****
--- 124,135 ----
dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
0, (dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev }
+ /* open, close, write, ioctl */
+ #define cdev_lpt_init(c,n) { \
+ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
+ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
+ 0, seltrue, (dev_type_mmap((*))) enodev }
+
cdev_decl(cn);
cdev_decl(ctty);
#define mmread mmrw
***************
*** 128,133 ****
--- 144,153 ----
#define ptcioctl ptyioctl
cdev_decl(ptc);
cdev_decl(log);
+ #if 0
+ #include "aconf.h"
+ cdev_decl(aconf);
+ #endif
cdev_decl(sd);
cdev_decl(cd);
#include "grf.h"
***************
*** 156,161 ****
--- 176,184 ----
#include "bpfilter.h"
cdev_decl(bpf);
#include "tun.h"
+ #if 0
+ #define tunioctl tuncioctl /* XXX could be needed. Markus had it... */
+ #endif
cdev_decl(tun);
#ifdef LKM
#define NLKM 1
***************
*** 163,168 ****
--- 186,195 ----
#define NLKM 0
#endif
cdev_decl(lkm);
+ #include "com.h"
+ cdev_decl(com);
+ #include "lpt.h"
+ cdev_decl(lpt);
struct cdevsw cdevsw[] =
{
***************
*** 173,179 ****
cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
cdev_log_init(1,log), /* 6: /dev/klog */
- cdev_disk_init(NCCD,ccd), /* 7: concatenated disk driver */
cdev_disk_init(NSD,sd), /* 8: SCSI disk */
cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
cdev_grf_init(NGRF,grf), /* 10: frame buffer */
--- 200,205 ----
***************
*** 199,204 ****
--- 225,233 ----
cdev_lkm_dummy(), /* 28 */
cdev_lkm_dummy(), /* 29 */
cdev_lkm_dummy(), /* 30 */
+ cdev_tty_init(NCOM,com), /* 31: ISA serial port */
+ cdev_lpt_init(NLPT,lpt), /* 32: parallel printer */
+ cdev_aconf_init(NACONF,aconf), /* 33: /dev/autoconfig */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
***************
*** 291,296 ****
--- 320,327 ----
/* 28 */ NODEV,
/* 29 */ NODEV,
/* 30 */ NODEV,
+ /* 31 */ NODEV,
+ /* 32 */ NODEV,
};
/*
***************
*** 317,322 ****
--- 348,354 ----
*/
cons_decl(ser);
cons_decl(ite);
+ cons_decl(com);
struct consdev constab[] = {
#if NSER > 0
***************
*** 324,329 ****
--- 356,366 ----
#endif
#if NITE > 0
cons_init(ite),
+ #endif
+ #if 0
+ #if NCOM > 0
+ cons_init(com),
+ #endif
#endif
{ 0 },
};
*** /dev/null
--- NetBSD/src/sys/arch/amiga/amiga/db_memrw.c
***************
*** 0 ****
--- 1,161 ----
+ /* $NetBSD: db_memrw.c,v 1.4 1994/11/28 19:33:08 gwr Exp $ */
+
+ /*
+ * Copyright (c) 1994 Gordon W. Ross
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ /*
+ * Interface to the debugger for virtual memory read/write.
+ * To write in the text segment, we have to first make
+ * the page writable, do the write, then restore the PTE.
+ * For reads, validate address first to avoid MMU trap.
+ */
+
+ #include <sys/param.h>
+ #include <sys/proc.h>
+
+ #include <vm/vm.h>
+
+ #include <machine/db_machdep.h>
+ #include <machine/pte.h>
+
+ /*
+ * Read one byte somewhere in the kernel.
+ * It does not matter if this is slow. -gwr
+ */
+ static char
+ db_read_data(src)
+ char *src;
+ {
+ u_int *pte;
+ vm_offset_t pgva;
+ int ch;
+
+ pgva = amiga_trunc_page((long)src);
+ pte = kvtopte(pgva);
+
+ if ((*pte & PG_V) == 0) {
+ db_printf(" address 0x%x not a valid page\n", src);
+ return 0;
+ }
+ return (*src);
+ }
+
+ /*
+ * Read bytes from kernel address space for debugger.
+ * It does not matter if this is slow. -gwr
+ */
+ void
+ db_read_bytes(addr, size, data)
+ vm_offset_t addr;
+ register int size;
+ register char *data;
+ {
+ char *src, *limit;
+
+ src = (char *)addr;
+ limit = src + size;
+
+ while (src < limit) {
+ *data = db_read_data(src);
+ data++;
+ src++;
+ }
+ }
+
+ /*
+ * Write one byte somewhere in kernel text.
+ * It does not matter if this is slow. -gwr
+ */
+ static void
+ db_write_text(dst, ch)
+ char *dst;
+ int ch;
+ {
+ u_int *pte, oldpte;
+ vm_offset_t pgva;
+
+ pgva = amiga_trunc_page((long)dst);
+ pte = kvtopte(pgva);
+ oldpte = *pte;
+ if ((oldpte & PG_V) == 0) {
+ db_printf(" address 0x%x not a valid page\n", dst);
+ return;
+ }
+
+ *pte = oldpte & ~PG_RO;
+
+ *dst = (char) ch;
+
+ *pte = oldpte;
+ }
+
+ /*
+ * Write one byte somewhere outside kernel text.
+ * It does not matter if this is slow. -gwr
+ */
+ static void
+ db_write_data(dst, ch)
+ char *dst;
+ int ch;
+ {
+ u_int *pte;
+ vm_offset_t pgva;
+
+ pgva = amiga_trunc_page((long)dst);
+ pte = kvtopte(pgva);
+
+ if ((*pte & (PG_V | PG_RO)) != PG_V) {
+ db_printf(" address 0x%x not a valid page\n", dst);
+ return;
+ }
+ *dst = (char) ch;
+ }
+
+ /*
+ * Write bytes to kernel address space for debugger.
+ */
+ void
+ db_write_bytes(addr, size, data)
+ vm_offset_t addr;
+ int size;
+ char *data;
+ {
+ extern char etext[] ;
+ char *dst, *limit;
+
+ dst = (char *)addr;
+ limit = dst + size;
+
+ while (dst < limit) {
+ if (dst < etext) /* kernel text starts at 0 */
+ db_write_text(dst, *data);
+ else
+ db_write_data(dst, *data);
+ dst++;
+ data++;
+ }
+ }
*** old-NetBSD/src/sys/arch/amiga/amiga/genassym.c
--- NetBSD/src/sys/arch/amiga/amiga/genassym.c
***************
*** 110,115 ****
--- 110,116 ----
printf("#define\tT_TRAP15 %d\n", T_TRAP15);
printf("#define\tPSL_S %d\n", PSL_S);
printf("#define\tPSL_IPL7 %d\n", PSL_IPL7);
+ printf("#define\tPSL_IPL %d\n", PSL_IPL);
printf("#define\tPSL_LOWIPL %d\n", PSL_LOWIPL);
printf("#define\tPSL_HIGHIPL %d\n", PSL_HIGHIPL);
printf("#define\tPSL_USER %d\n", PSL_USER);
*** old-NetBSD/src/sys/arch/amiga/amiga/isr.h
--- NetBSD/src/sys/arch/amiga/amiga/isr.h
***************
*** 41,46 ****
--- 41,47 ----
int (*isr_intr)();
void *isr_arg;
int isr_ipl;
+ int isr_mapped_ipl;
};
#define NISR 3
*** old-NetBSD/src/sys/arch/amiga/amiga/kdassert.h
--- NetBSD/src/sys/arch/amiga/amiga/kdassert.h
***************
*** 53,55 ****
--- 53,56 ----
#define KDASSERT(x)
#endif /* !DEBUG */
#endif /* _KDASSERT_H */
+
*** old-NetBSD/src/sys/arch/amiga/amiga/locore.s
--- NetBSD/src/sys/arch/amiga/amiga/locore.s
***************
*** 49,62 ****
#include "assym.s"
#include <amiga/amiga/vectors.s>
#include <amiga/amiga/custom.h>
#define CIAAADDR(ar) movl _CIAAbase,ar
#define CIABADDR(ar) movl _CIABbase,ar
#define CUSTOMADDR(ar) movl _CUSTOMbase,ar
#define INTREQRADDR(ar) movl _INTREQRaddr,ar
#define INTREQWADDR(ar) movl _INTREQWaddr,ar
! #define INTENAWADDR(ar) movl _amiga_intena_write,ar
! #define INTENARADDR(ar) movl _amiga_intena_read,ar
.text
/*
--- 49,62 ----
#include "assym.s"
#include <amiga/amiga/vectors.s>
#include <amiga/amiga/custom.h>
+ #include "ser.h"
#define CIAAADDR(ar) movl _CIAAbase,ar
#define CIABADDR(ar) movl _CIABbase,ar
#define CUSTOMADDR(ar) movl _CUSTOMbase,ar
#define INTREQRADDR(ar) movl _INTREQRaddr,ar
#define INTREQWADDR(ar) movl _INTREQWaddr,ar
! #define INTENAWADDR(ar) movl _INTENAWaddr,a0
.text
/*
***************
*** 473,482 ****
* Interrupt handlers.
*
* Level 0: Spurious: ignored.
! * Level 1: builtin-RS232 TBE, softint (not used yet)
* Level 2: keyboard (CIA-A) + DMA + SCSI
* Level 3: VBL
! * Level 4: not used
* Level 5: builtin-RS232 RBF
* Level 6: Clock (CIA-B-Timers)
* Level 7: Non-maskable: shouldn't be possible. ignore.
--- 473,482 ----
* Interrupt handlers.
*
* Level 0: Spurious: ignored.
! * Level 1: builtin-RS232 TBE, softint
* Level 2: keyboard (CIA-A) + DMA + SCSI
* Level 3: VBL
! * Level 4: Audio
* Level 5: builtin-RS232 RBF
* Level 6: Clock (CIA-B-Timers)
* Level 7: Non-maskable: shouldn't be possible. ignore.
***************
*** 486,492 ****
* and serial RBF (int5) specially, to improve performance
*/
! .globl _intrhand, _hardclock
_spurintr:
addql #1,_intrcnt+0
--- 486,493 ----
* and serial RBF (int5) specially, to improve performance
*/
! .globl _intrhand
! .globl _hardclock
_spurintr:
addql #1,_intrcnt+0
***************
*** 495,501 ****
_lev5intr:
moveml d0/d1/a0/a1,sp@-
- #include "ser.h"
#if NSER > 0
jsr _ser_fastint
#else
--- 496,501 ----
***************
*** 510,520 ****
_lev1intr:
_lev2intr:
_lev3intr:
- #ifndef LEV6_DEFER
_lev4intr:
! #endif
! moveml #0xC0C0,sp@-
! Lintrcommon:
lea _intrcnt,a0
movw sp@(22),d0 | use vector offset
andw #0xfff,d0 | sans frame type
--- 510,517 ----
_lev1intr:
_lev2intr:
_lev3intr:
_lev4intr:
! moveml d0/d1/a0/a1,sp@- | save scratch regs
lea _intrcnt,a0
movw sp@(22),d0 | use vector offset
andw #0xfff,d0 | sans frame type
***************
*** 523,622 ****
clrw sp@- | padded to longword
jbsr _intrhand | handle interrupt
addql #4,sp | pop SR
! moveml sp@+,#0x0303
addql #1,_cnt+V_INTR
jra rei
_lev6intr:
! #ifdef LEV6_DEFER
! /*
! * cause a level 4 interrupt (AUD3) to occur as soon
! * as we return. Block generation of level 6 ints until
! * we have dealt with this one.
! */
! moveml #0x8080,sp@-
INTREQRADDR(a0)
movew a0@,d0
! btst #INTB_EXTER,d0
! jeq Llev6spur
! INTREQWADDR(a0)
! movew #INTF_SETCLR+INTF_AUD3,a0@
! INTENAWADDR(a0)
! movew #INTF_EXTER,a0@
! movew #INTF_SETCLR+INTF_AUD3,a0@ | make sure THIS one is ok...
! moveml sp@+,#0x0101
! rte
! Llev6spur:
! addql #1,_intrcnt+36 | count spurious level 6 interrupts
! moveml sp@+,#0x0101
! rte
!
! _lev4intr:
! _fake_lev6intr:
! #endif
! moveml #0xC0C0,sp@-
! #ifdef LEV6_DEFER
! /*
! * check for fake level 6
! */
! INTREQRADDR(a0)
! movew a0@,d0
! btst #INTB_EXTER,d0
! jeq Lintrcommon | if EXTER not pending, handle normally
! #endif
!
! CIABADDR(a0)
! movb a0@(CIAICR),d0 | read irc register (clears ints!)
! tstb d0 | check if CIAB was source
! jeq Lchkexter | no, go through isr chain
! INTREQWADDR(a0)
! #ifndef LEV6_DEFER
! movew #INTF_EXTER,a0@ | clear EXTER interrupt in intreq
! #else
! movew #INTF_EXTER+INTF_AUD3,a0@ | clear EXTER & AUD3 in intreq
INTENAWADDR(a0)
! movew #INTF_SETCLR+INTF_EXTER,a0@ | reenable EXTER interrupts
! #endif
! btst #0,d0 | timerA interrupt?
! jeq Lskipciab | no
! | save d0 if we want to check other CIAB interrupts?
! lea sp@(16),a1 | get pointer to PS
! movl a1,sp@- | push pointer to PS, PC
! jbsr _hardclock | call generic clock int routine
! addql #4,sp | pop params
! addql #1,_intrcnt+32 | add another system clock interrupt
! Lskipciab:
! | process any other CIAB interrupts?
! Llev6done:
! moveml sp@+,#0x0303 | restore scratch regs
addql #1,_cnt+V_INTR | chalk up another interrupt
! jra rei | all done [can we do rte here?]
! Lchkexter:
! | check to see if EXTER request is really set?
! movl _isr_exter,a0 | get head of EXTER isr chain
! Lnxtexter:
! movl a0,d0 | test if any more entries
! jeq Lexterdone | (spurious interrupt?)
! movl a0,sp@- | save isr pointer
! movl a0@(ISR_ARG),sp@-
! movl a0@(ISR_INTR),a0
! jsr a0@ | call isr handler
! addql #4,sp
! movl sp@+,a0 | restore isr pointer
! movl a0@(ISR_FORW),a0 | get next pointer
! tstl d0 | did handler process the int?
! jeq Lnxtexter | no, try next
! Lexterdone:
! INTREQWADDR(a0)
! #ifndef LEV6_DEFER
! movew #INTF_EXTER,a0@ | clear EXTER interrupt
! #else
! movew #INTF_EXTER+INTF_AUD3,a0@ | clear EXTER & AUD3 interrupt
! INTENAWADDR(a0)
! movew #INTF_SETCLR+INTF_EXTER,a0@ | reenable EXTER interrupts
! #endif
! addql #1,_intrcnt+24 | count EXTER interrupts
! jra Llev6done
_lev7intr:
addql #1,_intrcnt+28
--- 520,560 ----
clrw sp@- | padded to longword
jbsr _intrhand | handle interrupt
addql #4,sp | pop SR
! moveml sp@+,d0/d1/a0/a1 | restore scratch regs
addql #1,_cnt+V_INTR
jra rei
+ .globl _isr_exter_ipl
+ .globl _isr_exter_highipl
+ .globl _isr_exter_lowipl
+ .globl _hardclock_frame
+
_lev6intr:
! moveml d0-d1/a0-a1,sp@- | save clobbered regs
! #if 0
INTREQRADDR(a0)
movew a0@,d0
! btst #INTB_EXTER,d0 | check for non-EXTER INT6 ints
! jne Lexter
! | register spurious int6 interrupt
! Lexter:
! #endif
! moveal #_hardclock_frame,a0 | store the clockframe
! movel sp@(16),a0@+ | where hardclock will find it
! movel sp@(20),a0@
INTENAWADDR(a0)
! movew #INTF_EXTER,a0@ | disable EXTER ints
! movew sp@(16),d0 | get PS-word
! andl #PSL_IPL,d0 | only IPL is interesting
! orw #PSL_S,d0 | note we're in kernel mode
! movel d0,sp@-
! movel _isr_exter_highipl,sp@- | start out at the highest IPL
! jbsr _walk_ipls | run all ISRs at appropriate IPLs
! addql #8,sp
! addql #1,_intrcnt+24 | add another exter interrupt
! moveml sp@+,d0-d1/a0-a1 | restore scratch regs
addql #1,_cnt+V_INTR | chalk up another interrupt
! jra Lastchk | all done [can we do rte here?]
_lev7intr:
addql #1,_intrcnt+28
***************
*** 627,633 ****
*/
rte | all done
-
/*
* Emulation of VAX REI instruction.
*
--- 565,570 ----
***************
*** 653,658 ****
--- 590,607 ----
tstl _panicstr | have we paniced?
jne Ldorte | yes, do not make matters worse
#endif
+ tstl _isr_exter_ipl | IPL lowering in process?
+ jeq Lastchk | no, go on to check for ASTs
+ moveml d0-d1/a0-a1,sp@- | save scratch regs
+ movw sp@(16),d0 | get PS
+ andl #PSL_IPL,d0 | we're only interested in the IPL
+ orw #PSL_S,d0 | note that we're in kernel mode
+ movel d0,sp@-
+ movel _isr_exter_ipl,sp@- | start where we left last walk_ipls
+ jbsr _walk_ipls | run needed ISRs
+ addql #8,sp | pop params
+ moveml sp@+,d0-d1/a0-a1 | restore scratch regs
+ Lastchk:
tstl _astpending | AST pending?
jeq Ldorte | no, done
Lrei1:
***************
*** 737,742 ****
--- 686,697 ----
movl #0xbfd000,_CIABbase
movl #0xdff000,_CUSTOMbase
+ #ifdef BOOT_DEBUG
+ movl #0xfff,sp@-
+ jbsr _rollcolor
+ addql #4,sp
+ #endif
+
/*
* initialize the timer frequency
*/
***************
*** 2102,2119 ****
/* interrupt counters */
.globl _intrcnt,_eintrcnt,_intrnames,_eintrnames
_intrnames:
! .asciz "spur" | spurious interrupt
! .asciz "tbe/soft" | serial TBE & software
! .asciz "kbd/ports" | keyboard & PORTS
! .asciz "vbl" | vertical blank
! .asciz "audio" | audio channels
! .asciz "rbf" | serial receive
! .asciz "exter" | EXTERN
! .asciz "nmi" | non-maskable
! .asciz "clock" | clock interrupts
! .asciz "spur6" | spurious level 6
_eintrnames:
.align 2
_intrcnt:
! .long 0,0,0,0,0,0,0,0,0,0
_eintrcnt:
--- 2057,2072 ----
/* interrupt counters */
.globl _intrcnt,_eintrcnt,_intrnames,_eintrnames
_intrnames:
! .asciz "spur"
! .asciz "tbe/soft"
! .asciz "kbd/ports"
! .asciz "vbl"
! .asciz "audio"
! .asciz "rbf"
! .asciz "exter"
! .asciz "nmi"
_eintrnames:
.align 2
_intrcnt:
! .long 0,0,0,0,0,0,0,0,0
_eintrcnt:
*** old-NetBSD/src/sys/arch/amiga/amiga/machdep.c
--- NetBSD/src/sys/arch/amiga/amiga/machdep.c
***************
*** 138,144 ****
/* the following is used externally (sysctl_hw) */
char machine[] = "amiga";
! /*
* Console initialization: called early on from main,
* before vm init or startup. Do enough configuration
* to choose and initialize a console.
--- 138,184 ----
/* the following is used externally (sysctl_hw) */
char machine[] = "amiga";
! struct isr *isr_ports;
! struct isr *isr_exter[7];
! int isr_exter_lowipl = 7;
! int isr_exter_highipl = 0;
! int isr_exter_ipl = 0;
!
! /*
! * Poll all registered ISRs starting at IPL start_ipl going down to
! * isr_exter_lowipl. If we reach the IPL of ending_psw along the way
! * just return stating in isr_exter_ipl that we need to run the remaining
! * layers later when the IPL gets lowered (i.e. a spl? call). If some
! * ISR handles the interrupt, or all layers have been processed, enable
! * EXTER interrupts again and return.
! */
! void
! walk_ipls (start_ipl, ending_psw)
! int start_ipl;
! int ending_psw;
! {
! int i;
! int handled = 0;
!
! for (i = start_ipl; !handled && i >= isr_exter_lowipl; i--) {
! register int psw = i << 8 | PSL_S;
! struct isr *isr;
!
! if (psw <= ending_psw) {
! isr_exter_ipl = i;
! return;
! }
! __asm __volatile("movew %0,sr" : : "d" (psw) : "cc");
! for (isr = isr_exter[i]; !handled && isr; isr = isr->isr_forw)
! handled = (*isr->isr_intr)(isr->isr_arg);
! }
! isr_exter_ipl = 0;
! __asm __volatile("movew %0,sr" : : "di" (PSL_S|PSL_IPL6) : "cc");
! custom.intreq = INTF_EXTER;
! custom.intena = INTF_SETCLR | INTF_EXTER;
! }
!
! /*
* Console initialization: called early on from main,
* before vm init or startup. Do enough configuration
* to choose and initialize a console.
***************
*** 1078,1094 ****
* function calls executed at very low interrupt priority.
* Example for use is keyboard repeat, where the repeat
* handler running at splclock() triggers such a (hardware
! * aided) software interrupt.
! * Note: the installed functions are currently called in a
! * LIFO fashion, might want to change this to FIFO
! * later.
*/
struct si_callback {
struct si_callback *next;
void (*function) __P((void *rock1, void *rock2));
void *rock1, *rock2;
};
static struct si_callback *si_callbacks;
static struct si_callback *si_free;
#ifdef DIAGNOSTIC
static int ncb; /* number of callback blocks allocated */
--- 1118,1134 ----
* function calls executed at very low interrupt priority.
* Example for use is keyboard repeat, where the repeat
* handler running at splclock() triggers such a (hardware
! * aided) software interrupt. These functions are called in
! * a FIFO manner as expected.
*/
+
struct si_callback {
struct si_callback *next;
void (*function) __P((void *rock1, void *rock2));
void *rock1, *rock2;
};
static struct si_callback *si_callbacks;
+ static struct si_callback *si_callbacks_end;
static struct si_callback *si_free;
#ifdef DIAGNOSTIC
static int ncb; /* number of callback blocks allocated */
***************
*** 1147,1154 ****
si->rock2 = rock2;
s = splhigh();
! si->next = si_callbacks;
! si_callbacks = si;
splx(s);
/*
--- 1187,1198 ----
si->rock2 = rock2;
s = splhigh();
! si->next = NULL;
! if (si_callbacks)
! si_callbacks_end->next = si;
! else
! si_callbacks = si;
! si_callbacks_end = si;
splx(s);
/*
***************
*** 1180,1185 ****
--- 1224,1231 ----
psi->next = nsi;
else
si_callbacks = nsi;
+ if (si == si_callbacks_end)
+ si_callbacks_end = psi;
}
si = nsi;
}
***************
*** 1197,1202 ****
--- 1243,1249 ----
do {
s = splhigh ();
+ /* Yes, that's an *assignment* below! */
if (si = si_callbacks)
si_callbacks = si->next;
splx(s);
***************
*** 1224,1246 ****
#endif
}
- struct isr *isr_ports;
- struct isr *isr_exter;
-
void
add_isr(isr)
struct isr *isr;
{
struct isr **p, *q;
! p = isr->isr_ipl == 2 ? &isr_ports : &isr_exter;
while ((q = *p) != NULL)
p = &q->isr_forw;
isr->isr_forw = NULL;
*p = isr;
/* enable interrupt */
! custom.intena = isr->isr_ipl == 2 ? INTF_SETCLR | INTF_PORTS :
! INTF_SETCLR | INTF_EXTER;
}
void
--- 1271,1296 ----
#endif
}
void
add_isr(isr)
struct isr *isr;
{
struct isr **p, *q;
! p = isr->isr_ipl == 2 ? &isr_ports : &isr_exter[isr->isr_mapped_ipl];
! if (isr->isr_ipl == 6) {
! if (isr->isr_mapped_ipl > isr_exter_highipl)
! isr_exter_highipl = isr->isr_mapped_ipl;
! if (isr->isr_mapped_ipl < isr_exter_lowipl)
! isr_exter_lowipl = isr->isr_mapped_ipl;
! }
while ((q = *p) != NULL)
p = &q->isr_forw;
isr->isr_forw = NULL;
*p = isr;
/* enable interrupt */
! custom.intena = INTF_SETCLR |
! (isr->isr_ipl == 2 ? INTF_PORTS : INTF_EXTER);
}
void
***************
*** 1249,1255 ****
{
struct isr **p, *q;
! p = isr->isr_ipl == 6 ? &isr_exter : &isr_ports;
while ((q = *p) != NULL && q != isr)
p = &q->isr_forw;
if (q)
--- 1299,1305 ----
{
struct isr **p, *q;
! p = isr->isr_ipl == 6 ? &isr_exter[isr->isr_mapped_ipl] : &isr_ports;
while ((q = *p) != NULL && q != isr)
p = &q->isr_forw;
if (q)
***************
*** 1257,1265 ****
else
panic("remove_isr: handler not registered");
/* disable interrupt if no more handlers */
! p = isr->isr_ipl == 6 ? &isr_exter : &isr_ports;
! if (*p == NULL)
! custom.intena = isr->isr_ipl == 6 ? INTF_EXTER : INTF_PORTS;
}
intrhand(sr)
--- 1307,1328 ----
else
panic("remove_isr: handler not registered");
/* disable interrupt if no more handlers */
! p = isr->isr_ipl == 6 ? &isr_exter[isr->isr_mapped_ipl] : &isr_ports;
! if (*p == NULL) {
! if (isr->isr_ipl == 6) {
! if (isr->isr_mapped_ipl == isr_exter_lowipl)
! while (isr_exter_lowipl++ < 6 &&
! !isr_exter[isr_exter_lowipl])
! ;
! if (isr->isr_mapped_ipl == isr_exter_ipl)
! while (isr_exter_highipl-- > 0 &&
! !isr_exter[isr_exter_highipl])
! ;
! if (isr_exter_lowipl == 7)
! custom.intena = INTF_EXTER;
! } else if (isr->isr_ipl == 2)
! custom.intena = INTF_PORTS;
! }
}
intrhand(sr)
***************
*** 1292,1298 ****
/*
* first clear the softint-bit
* then process all classes of softints.
! * this order is dicated by the nature of
* software interrupts. The other order
* allows software interrupts to be missed
*/
--- 1355,1361 ----
/*
* first clear the softint-bit
* then process all classes of softints.
! * this order is dictated by the nature of
* software interrupts. The other order
* allows software interrupts to be missed
*/
***************
*** 1329,1339 ****
break;
case 3:
/* VBL */
! if (ireq & INTF_BLIT)
blitter_handler();
! if (ireq & INTF_COPER)
copper_handler();
! if (ireq & INTF_VERTB)
vbl_handler();
break;
#if 0
--- 1392,1402 ----
break;
case 3:
/* VBL */
! if (ireq & INTF_BLIT)
blitter_handler();
! if (ireq & INTF_COPER)
copper_handler();
! if (ireq & INTF_VERTB)
vbl_handler();
break;
#if 0
***************
*** 1422,1428 ****
if (doingdump)
return;
! s = splhigh();
doingdump = 1;
printf("pid = %d, pc = %s, ", curproc->p_pid, hexstr(fp->f_pc, 8));
printf("ps = %s, ", hexstr(fp->f_sr, 4));
--- 1485,1491 ----
if (doingdump)
return;
! s = spl7();
doingdump = 1;
printf("pid = %d, pc = %s, ", curproc->p_pid, hexstr(fp->f_pc, 8));
printf("ps = %s, ", hexstr(fp->f_sr, 4));
***************
*** 1528,1530 ****
--- 1591,1599 ----
#endif
return(error);
}
+
+ #ifdef SPL_PROF
+ struct _spl_ent _spl_stack[256];
+ struct _spl_ent *_spl_p = _spl_stack;
+ int spl_debug = 0, spl_prof = 0;
+ #endif
*** old-NetBSD/src/sys/arch/amiga/amiga/trap.c
--- NetBSD/src/sys/arch/amiga/amiga/trap.c
***************
*** 219,224 ****
--- 219,225 ----
struct frame *fp;
{
static int panicing = 0;
+
if (panicing++ == 0) {
printf("trap type %d, code = %x, v = %x\n", type, code, v);
regdump(fp, 128);
***************
*** 638,647 ****
--- 639,650 ----
return;
}
+ #if 0
#ifdef DEBUG
if (i != SIGTRAP)
printf("trapsignal(%d, %d, %d, %x, %x)\n", p->p_pid, i,
ucode, v, frame.f_regs[PC]);
+ #endif
#endif
trapsignal(p, i, ucode);
if ((type & T_USER) == 0)
*** /dev/null
--- NetBSD/src/sys/arch/amiga/conf/FILIPPA
***************
*** 0 ****
--- 1,255 ----
+ # $NetBSD: FILIPPA,v 1.29 1994/12/01 17:24:44 chopps Exp $
+
+ #
+ # FILIPPA (AMIGA 2000 with a Zeus, a GVP HC-8, a Retina and a GoldenGate II)
+ #
+ # This configuration file contains all possible options
+ #
+
+ include "std.amiga"
+
+ maxusers 8
+ options TIMEZONE=60, DST=1
+
+ #
+ # processors this kernel should support
+ #
+ options "M68040" # support for 040
+ options FPSP # MC68040 floating point support
+ #options "M68030" # support for 030
+ #options "M68020" # support for 020/851
+ options FPCOPROC # Support for MC6888[12] (Required)
+
+ options SWAPPAGER # Pager for processes (Required)
+ options VNODEPAGER # Pager for vnodes (Required)
+ options DEVPAGER # Pager for devices (Required)
+
+ #
+ # Networking options
+ #
+ options INET # IP networking support (Required)
+ #options ISO # ISO Networking support
+ #options TPIP # ARGO TP networking support
+ #options CCITT # CCITT X.25
+ #options NS # Xerox XNS
+ #options EON # ISO CLNL over IP
+ options GATEWAY # Packet forwarding
+ options DIRECTED_BROADCAST # Broadcast across subnets
+ #options NSIP # XNS over IP
+
+ #
+ # File system related options
+ #
+ #options QUOTA # Disk quotas for local disks
+ options NFSSERVER # Network File System server side code
+ options NFSCLIENT # Network File System client side code
+
+ #
+ # File systems
+ #
+ options FFS # Berkeley fast file system
+ options MFS # Memory based filesystem
+ options PROCFS # Process filesystem
+ options KERNFS # Kernel parameter filesystem (Recommended)
+ options FDESC # /dev/fd filesystem
+ options NULLFS # Loopback filesystem
+ options FIFO # FIFO operations on vnodes (Recommended)
+ options ADOSFS # AmigaDOS file system
+ options UNION
+ #options UMAPFS # The umap layer
+ #options MSDOSFS # MS-DOS filesystem
+ options "CD9660" # ISO 9660 file system, with Rock Ridge
+ #options PORTAL # Portal filesystem
+
+
+ #
+ # Compatability options for various existing systems
+ #
+ options "COMPAT_10" # compatability with older NetBSD release
+ #options "COMPAT_09" # compatability with older NetBSD release
+ options "COMPAT_43" # 4.3 BSD compatible system calls
+ #options COMPAT_SUNOS # Support to run Sun (m68k) executables
+ #options "TCP_COMPAT_42" # Use 4.2 BSD style TCP
+ options "COMPAT_NOMID" # allow nonvalid machine id executables
+ #options COMPAT_HPUX # HP300 compatability
+
+ #
+ # Support for System V IPC facilities.
+ #
+ #options SYSVSHM # System V-like shared memory
+ #options SYSVMSG # System V-like messages
+ #options SYSVSEM # System V-like semaphores
+
+ #
+ # Support for various kernel options
+ #
+ #options GENERIC # Mini-root boot support
+ options LKM # Loadable kernel modules
+ options KTRACE # Add kernel tracing system call
+ options DIAGNOSTIC # Add additional error checking code
+ options "NKMEMCLUSTERS=256" # Size of kernel malloc area
+
+ #
+ # Misc. debugging options
+ #
+ options PANICWAIT # Require keystroke to dump/reboot
+ options DEBUG # Add debugging statements
+ options DDB # Kernel debugger
+ #options SYSCALL_DEBUG # debug all syscalls.
+ #options SCSIDEBUG # Add SCSI debugging statements
+ #options KGDB # Kernel debugger (KGDB) support
+ #options PANICBUTTON # Forced crash via keypress (???)
+ options ISAED_DEBUG # ed ethernet driver dubugging
+ #options SPL_PROF # time spl regions
+
+ #
+ # Amiga specific options
+ #
+ options MACHINE_NONCONTIG # Non-contiguous memory support
+ options RETINACONSOLE # enable code to allow retina to be console
+ #options GRF_ECS # Enhanced Chip Set
+ options GRF_NTSC # NTSC
+ options GRF_PAL # PAL
+ #options "GRF_A2024" # Support for the A2024
+ #options GRF_AGA # AGA chip set
+ #options GRF_CL5426 # Cirrus board support (not yet)
+ #options "KFONT_8X11" # 8x11 font
+ options KFONT_CUSTOM
+ options EMULATE_3_BUTTONS # Emulate a middle button
+ options LEV6_DEFER # Defer handling of level 6 interrupts
+
+ #grfcc0 at mainbus0 # custom chips
+ grfrt0 at zbus0 # retina II
+ #grfrh0 at zbus0 # retina III
+ #grfcl0 at zbus0 # Picasso II/Piccalo/Spectrum
+
+ #grf0 at grfcc0
+ grf1 at grfrt0
+ #grf2 at grfrh0
+ #grf3 at grfcl0
+
+ #ite0 at grf0 # terminal emulators for grf's
+ ite1 at grf1 # terminal emulators for grf's
+ #ite2 at grf2 # terminal emulators for grf's
+ #ite3 at grf3 # terminal emulators for grf's
+
+ #mfc0 at zbus0 # MultiFaceCard I/O board
+ #mfcs0 at mfc0 unit 0 # MFC serial
+ #mfcs1 at mfc0 unit 1 # MFC serial
+ #mfcp0 at mfc0 unit 0 # MFC parallel [not available yet]
+ #mfc1 at zbus0 # MultiFaceCard 2nd I/O board
+ #mfcs2 at mfc1 unit 0
+ #mfcs3 at mfc1 unit 1
+ #mfcp1 at mfc1 unit 0
+
+ #le0 at zbus0 # Lance ethernet.
+ #zed0 at zbus0 # dp8390 ethernet
+ #zes0 at zbus0 # SMC 91C90 ethernet
+
+ # scsi stuff, all possible
+ #gvpbus0 at zbus0
+ #gtsc0 at gvpbus0 # GVP series II scsi
+ #gvpbus1 at zbus0
+ #gtsc1 at gvpbus1 # GVP series II scsi
+ #ahsc0 at mainbus0 # A3000 scsi
+ #atzsc0 at zbus0
+ #wstsc0 at zbus0 # Wordsync II scsi
+ #ivsc0 at zbus0 # IVS scsi
+ #mlhsc0 at zbus0 # Hacker scsi
+ #otgsc0 at zbus0 # 12 gauge scsi
+ zssc0 at zbus0 # Zeus scsi
+ #mgnsc0 at zbus0 # Magnum scsi
+ #wesc0 at zbus0 # Warp Engine scsi
+ #idesc0 at mainbus0 # A4000(A1200?) IDE
+ #afsc0 at zbus0 # A4091 scsi
+ #flz3sc0 at zbus0 # FastlaneZ3 scsi
+
+ #scsibus* at gtsc?
+ #scsibus* at atzsc0
+ #scsibus* at wstsc0
+ #scsibus* at ivsc0
+ #scsibus* at mlhsc0
+ #scsibus* at otgsc0
+ scsibus* at zssc0
+ #scsibus* at mgnsc0
+ #scsibus* at wesc0
+ #scsibus* at idesc0
+ #scsibus* at afsc0
+ #scsibus* at flz3sc0
+
+ #
+ # compat.
+ #
+ #sd0 at scsibus? target 0 lun 0
+ #sd1 at scsibus? target 1 lun 0
+ #sd2 at scsibus? target 2 lun 0
+ #sd3 at scsibus? target 3 lun 0
+ #sd4 at scsibus? target 4 lun 0
+ #sd5 at scsibus? target 5 lun 0
+ #sd6 at scsibus? target 6 lun 0
+ #sd7 at scsibus? target 7 lun 0
+ #sd8 at scsibus? target 0 lun 0
+ #sd9 at scsibus? target 1 lun 0
+ #sd10 at scsibus? target 2 lun 0
+ #sd11 at scsibus? target 3 lun 0
+ #sd12 at scsibus? target 4 lun 0
+ #sd13 at scsibus? target 5 lun 0
+ #sd14 at scsibus? target 6 lun 0
+ #sd15 at scsibus? target 7 lun 0
+
+ #
+ # This is nicer however many amiga setups expect sd units to refer to
+ # scsi target numbers. If this is not the case, you can remove the
+ # specific sdx lines above and each hard drive from low target to high
+ # will configure to the next available sd unit number
+
+ sd* at scsibus? target ? lun ? # scsi disks
+ st* at scsibus? target ? lun ? # scsi tapes
+ cd* at scsibus? target ? lun ? # scsi cd's
+
+ ggbus0 at zbus0 # Goldengate bridge
+ isa* at ggbus0
+
+ #cross0 at zbus0 # CrossLink bridge
+ #isa* at cross0
+
+ com0 at isa? port 0x3f8 irq 4 # Standard PC serial ports
+ com1 at isa? port 0x2f8 irq 3
+ com2 at isa? port 0x3e8 irq 5
+ com3 at isa? port 0x2e8 irq 9
+
+ #com0 at isa? port 0x0f0 irq 11 # Crosslink builtin ports
+ #com1 at isa? port 0x0f8 irq 10
+
+ ast0 at isa? port 0x1a0 irq 3 # AST 4-port serial cards
+ #com* at ast? slave ? flags 1
+ com4 at ast? slave ? flags 1
+ com5 at ast? slave ? flags 1
+ com6 at ast? slave ? flags 1
+ com7 at ast? slave ? flags 1
+
+ lpt0 at isa? port 0x378 irq 7 # Standard PC arallel ports
+ lpt1 at isa? port 0x278
+ lpt2 at isa? port 0x3bc
+
+ # XXX should be ed0
+ isaed0 at isa? port 0x300 iomem 0xcc000 irq 10 # WD/SMC, 3C503, and NE[12]000
+ # ethernetcards
+
+ fd* at fdc0 unit ?
+
+ #pseudo-device mouse 1 # mouse
+ pseudo-device view 2 # views
+ #pseudo-device aconf # autoconfig info
+
+ pseudo-device loop 1 # network loopback
+ pseudo-device bpfilter 8 # packet filter
+ pseudo-device sl 2 # CSLIP
+ pseudo-device ppp 2 # PPP
+ pseudo-device tun 2 # network tunneling over tty
+
+ pseudo-device pty 64 # pseudo-terminals
+ pseudo-device vnd 4 # paging to files
+
+ #config netbsd swap on generic
+ config netbsd root on sd1a swap on sd1b and sd2b
*** old-NetBSD/src/sys/arch/amiga/conf/GENERIC
--- NetBSD/src/sys/arch/amiga/conf/GENERIC
***************
*** 159,166 ****
#mfcp1 at mfc1 unit 0
le0 at zbus0 # Lance ethernet.
! ed0 at zbus0 # dp8390 ethernet
! es0 at zbus0 # SMC 91C90 ethernet
ae0 at zbus0 # Ariadne ethernet
# scsi stuff, all possible
--- 159,166 ----
#mfcp1 at mfc1 unit 0
le0 at zbus0 # Lance ethernet.
! zed0 at zbus0 # dp8390 ethernet
! zes0 at zbus0 # SMC 91C90 ethernet
ae0 at zbus0 # Ariadne ethernet
# scsi stuff, all possible
*** old-NetBSD/src/sys/arch/amiga/conf/Makefile.amiga
--- NetBSD/src/sys/arch/amiga/conf/Makefile.amiga
***************
*** 33,39 ****
S= ../../../..
AMIGA= ../..
! INCLUDES= -I. -I$S/arch -I$S -I$S/sys
COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Damiga
CFLAGS= -O -mc68020 -m68881 ${COPTS}
--- 33,39 ----
S= ../../../..
AMIGA= ../..
! INCLUDES= -I. -I../.. -I$S/arch -I$S -I$S/sys
COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Damiga
CFLAGS= -O -mc68020 -m68881 ${COPTS}
*** /dev/null
--- NetBSD/src/sys/arch/amiga/conf/files.amiga.newconf
***************
*** 0 ****
--- 1,259 ----
+ # $NetBSD: files.amiga.newconf,v 1.17 1995/02/12 19:18:57 chopps Exp $
+
+ # maxpartitions must be first item in files.${ARCH}.newconf
+ maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
+
+ maxusers 2 8 64
+
+ device mainbus at root {}
+
+ device cpu at mainbus
+
+ # zorro II expansion bus.
+ device zbus at mainbus {}
+ file arch/amiga/dev/zbus.c zbus
+
+ define event {}
+ file arch/amiga/dev/event.c event
+
+ device clock at mainbus
+ file arch/amiga/dev/clock.c
+
+ # keyboard
+ device kbd at mainbus: event
+ file arch/amiga/dev/kbd.c kbd needs-flag
+
+ # serial port
+ device ser at mainbus: tty
+ file arch/amiga/dev/ser.c ser needs-count
+
+ # parellel port
+ device par at mainbus
+ file arch/amiga/dev/par.c par needs-count
+
+ # mouse
+ pseudo-device mouse
+ file arch/amiga/dev/ms.c mouse needs-count
+
+ device fdc at mainbus { unit = -1 }
+
+ device fd at fdc
+ file arch/amiga/dev/fd.c fd needs-flag
+ major {fd = 2}
+
+ # graphic devices
+ define grfbus {}
+
+ device grf at grfbus {}
+ file arch/amiga/dev/grf.c grf needs-count
+
+ device ite at grf
+ file arch/amiga/dev/ite.c ite needs-flag
+ file arch/amiga/dev/kbdmap.c ite
+ file arch/amiga/dev/kf_8x8.c ite
+ file arch/amiga/dev/kf_8x11.c kfont_8x11
+ file arch/amiga/dev/kf_custom.c kfont_custom
+
+ # custom chips grf
+ device grfcc at mainbus: grfbus
+ file arch/amiga/dev/grf_cc.c grfcc needs-flag
+ file arch/amiga/dev/ite_cc.c grfcc ite
+
+ pseudo-device view
+ file arch/amiga/dev/view.c view grfcc needs-count
+ file arch/amiga/dev/grfabs.c grfcc view
+ file arch/amiga/dev/grfabs_cc.c grfcc view
+ file arch/amiga/dev/grfabs_ccglb.c grfcc view
+
+ # retina grf
+ device grfrt at zbus: grfbus
+ file arch/amiga/dev/grf_rt.c grfrt needs-flag
+ file arch/amiga/dev/ite_rt.c grfrt ite
+
+ # cirrus grf
+ device grfcl at zbus: grfbus
+ file arch/amiga/dev/grf_cl.c grfcl needs-flag
+
+ # retina ZIII grf
+ device grfrh at zbus: grfbus
+ file arch/amiga/dev/grf_rh.c grfrh needs-flag
+ file arch/amiga/dev/ite_rh.c grfrh ite
+
+ # handle gvp's odd autoconf info..
+ device gvpbus at zbus {}
+ file arch/amiga/dev/gvpbus.c gvpbus
+
+ define bridge {}
+
+ # GoldenGate bridge
+ device ggbus at zbus: bridge
+ file arch/amiga/dev/ggbus.c ggbus needs-flag
+
+ # CrossLink bridge
+ device cross at zbus: bridge
+ file arch/amiga/dev/cross.c cross needs-flag
+
+ # Generic bridge driver
+ device isa at bridge {[port = -1], [size = 0],
+ [iomem = -1], [iosiz = 0],
+ [irq = -1], [drq = -1]}
+
+ #
+ # ISA drivers
+ #
+ file arch/amiga/isa/isa.c isa
+
+ define commulti {[slave = -1]}
+ device ast at isa: commulti
+ file dev/isa/ast.c ast
+ device boca at isa: commulti
+ file dev/isa/boca.c boca
+ device rtfps at isa: commulti
+ file dev/isa/rtfps.c rtfps
+
+ device com at isa, commulti: tty
+ file dev/isa/com.c com needs-count
+
+ device lpt at isa
+ file dev/isa/lpt.c lpt needs-flag
+
+ device isaed at isa: ifnet, ether
+ file arch/amiga/isa/if_isaed.c isaed
+
+ #
+ # Zorro devices again
+ #
+ device zle at zbus: ifnet, ether
+ file arch/amiga/dev/if_zle.c zle needs-count
+
+ device zed at zbus: ifnet, ether
+ file arch/amiga/dev/if_zed.c zed needs-flag
+
+ device es at zbus: ifnet, ether
+ file arch/amiga/dev/if_es.c es needs-count
+
+ # Alf Data MultiFaceCard 3
+ #device mfch at zbus: tty
+ #file arch/amiga/dev/mfch.c mfch needs-count
+ # bsc/Alf Data MultiFaceCard
+ device mfc at zbus { unit = -1 }
+
+ device mfcs at mfc
+ device mfcp at mfc
+ file arch/amiga/dev/mfc.c mfcs mfcp needs-count
+
+ define scsi {}
+
+ # wd 33c93 controllers
+ define sbic
+ file arch/amiga/dev/sbic.c sbic
+
+ # C= A2091
+ device atzsc at zbus: scsi, sbic
+ file arch/amiga/dev/atzsc.c atzsc needs-flag
+
+ # GVP series II
+ device gtsc at gvpbus: scsi, sbic
+ file arch/amiga/dev/gtsc.c gtsc needs-flag
+
+ # Amiga 3000 internal
+ device ahsc at mainbus: scsi, sbic
+ file arch/amiga/dev/ahsc.c ahsc needs-flag
+
+ # ncr 57c710 controllers
+ define siop
+ file arch/amiga/dev/siop.c siop
+
+ # PPI Zeus
+ device zssc at zbus: scsi, siop
+ file arch/amiga/dev/zssc.c zssc needs-flag
+
+ # CSA Magnum
+ device mgnsc at zbus: scsi, siop
+ file arch/amiga/dev/mgnsc.c mgnsc needs-flag
+
+ # MacroSystems Warp Engine
+ device wesc at zbus: scsi, siop
+ file arch/amiga/dev/wesc.c wesc needs-flag
+
+ # C= A4091
+ device afsc at zbus: scsi, siop
+ file arch/amiga/dev/afsc.c afsc needs-flag
+
+ # ncr 5380 controllers
+ define sci
+ file arch/amiga/dev/sci.c sci
+
+ # Supra Wordsync II
+ device wstsc at zbus: scsi, sci
+ file arch/amiga/dev/wstsc.c wstsc needs-flag
+
+ # IVS
+ device ivsc at zbus: scsi, sci
+ file arch/amiga/dev/ivsc.c ivsc needs-flag
+
+ # CSA twelve gauge.
+ device otgsc at zbus: scsi, sci
+ file arch/amiga/dev/otgsc.c otgsc needs-flag
+
+ # MLH
+ device mlhsc at zbus: scsi, sci
+ file arch/amiga/dev/mlhsc.c mlhsc needs-flag
+
+ # Emulex ESP216 & FAS216 controllers
+ define fas
+ file arch/amiga/dev/fas.c fas
+
+ # FastlaneZ3
+ device flz3sc at zbus: scsi, fas
+ file arch/amiga/dev/flz3sc.c flz3sc needs-flag
+
+ # Amiga 4000/1200 IDE masquerading as SCSI
+ device idesc at mainbus: scsi
+ file arch/amiga/dev/idesc.c idesc needs-flag
+
+ device scsibus at scsi {target = -1, lun = -1}
+
+ device cd at scsibus: disk
+ file scsi/cd.c cd needs-flag
+ major {cd = 6}
+ device sd at scsibus: disk
+ file scsi/sd.c sd needs-flag
+ major {sd = 4}
+ device st at scsibus: tape
+ file scsi/st.c st needs-flag
+ major {st = 5}
+ device ch at scsibus: disk
+ file scsi/ch.c ch needs-flag
+ device uk at scsibus: disk
+ file scsi/uk.c uk needs-flag
+ device su at scsibus: disk
+ file scsi/su.c su needs-flag
+
+ pseudo-device aconf
+ file arch/amiga/dev/aconfdev.c aconf
+
+ # list of standard files...
+ file dev/cons.c ite ser
+ file scsi/scsi_base.c scsi
+ file scsi/scsi_ioctl.c scsi
+ file scsi/scsiconf.c scsi
+ file arch/amiga/amiga/amiga_init.c
+ file arch/amiga/amiga/autoconf.c
+ file arch/amiga/amiga/cia.c
+ file arch/amiga/amiga/conf.c
+ file arch/amiga/amiga/disksubr.c
+ file arch/amiga/amiga/dkbad.c
+ file arch/amiga/amiga/machdep.c
+ file arch/amiga/amiga/mem.c
+ file arch/amiga/amiga/pmap.c
+ file arch/amiga/amiga/sys_machdep.c
+ file arch/amiga/amiga/trap.c
+ file arch/amiga/amiga/vm_machdep.c
+ file arch/amiga/amiga/cc.c
+ file arch/amiga/amiga/db_memrw.c ddb
+ file arch/m68k/m68k/copy.s
+ file compat/sunos/sunos_misc.c compat_sunos
+ file compat/sunos/sunos_init_sysent.c compat_sunos
+ file compat/sunos/sunos_ioctl.c compat_sunos
+ file compat/sunos/sunos_exec.c compat_sunos
*** /dev/null
--- NetBSD/src/sys/arch/amiga/dev/aconfdev.c
***************
*** 0 ****
--- 1,168 ----
+ /*
+ * Copyright (c) 1994 Endicor Technologies, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by
+ * Endicor Technologies, Inc. and its contributors.
+ * 4. Neither the name of the Endicor nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ENDICOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL ENDICOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ *
+ * aconfdev.c -- driver for AUTOCONFIG (TM) information
+ *
+ * AUTOCONFIG is a trademark of Commodore Electronics Limited.
+ */
+
+ #include "aconf.h"
+
+ #if NACONF > 0
+ #include "sys/param.h"
+ #include "sys/systm.h"
+ #include "sys/ioctl.h"
+ #include "sys/tty.h"
+ #include "sys/proc.h"
+ #include "sys/conf.h"
+ #include "sys/file.h"
+ #include "sys/uio.h"
+ #include "sys/kernel.h"
+ #include "sys/syslog.h"
+
+ #include "device.h"
+ #include "machine/cpu.h"
+
+ #include "../amiga/configdev.h"
+ #include "../amiga/memlist.h"
+
+
+ /*ARGSUSED*/
+ void
+ aconfattach(n)
+ int n;
+ {
+ }
+
+ /*ARGSUSED*/
+ aconfioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ caddr_t data;
+ struct proc *p;
+ {
+ extern struct Mem_List *mem_list;
+ extern int num_ConfigDev;
+ extern struct ConfigDev *ConfigDev;
+ struct amiga_hw *hw;
+ static int numhw = -1;
+ int error = 0;
+
+ if (numhw < 0) {
+ numhw = 0;
+ for (hw = sc_table; hw->hw_type; hw++)
+ numhw++;
+ }
+
+ switch (cmd) {
+
+ case ACIOCGINFO: {
+ struct ConfigInfo *ci = (struct ConfigInfo *)data;
+
+ ci->ci_NumConfigDev = num_ConfigDev;
+ ci->ci_NumHWDev = numhw;
+ ci->ci_NumMemSegs = mem_list->num_mem;
+
+ ci->ci_CPUType = machineid;
+ ci->ci_CPUSpeed = cpuspeed;
+ ci->ci_MMUType = mmutype;
+
+ break;
+ }
+
+ case ACIOCGCDEV: {
+ struct ConfigDev *cd = (struct ConfigDev *)data;
+ int num;
+
+ num = cd->cd_Number;
+ if (num >= num_ConfigDev) {
+ error = EINVAL;
+ } else {
+ bcopy( &ConfigDev[num],
+ cd,
+ sizeof(struct ConfigDev)
+ );
+ }
+
+ break;
+ }
+
+ case ACIOCGAHWD: {
+ struct ConfigDev *cd = (struct ConfigDev *)data;
+ int num;
+
+ num = cd->cd_Number;
+ if (num >= numhw) {
+ error = EINVAL;
+ } else {
+ bzero(cd, sizeof(ConfigDev));
+
+ hw = &sc_table[num];
+
+ cd->cd_BoardAddr = hw->hw_pa;
+ cd->cd_BoardSize = hw->hw_size;
+ cd->cd_Rom.er_Manufacturer = hw->hw_manufacturer;
+ cd->cd_Rom.er_Product = hw->hw_product;
+ cd->cd_Rom.er_SerialNumber = hw->hw_serno;
+ cd->cd_Rom.er_Type = hw->hw_type;
+ }
+
+ break;
+ }
+
+ case ACIOCGMSEG: {
+ struct Mem_List *ml = (struct Mem_List *)data;
+ int num;
+
+ num = ml->num_mem;
+ if (num >= mem_list->num_mem) {
+ error = EINVAL;
+ } else {
+ bcopy( &(mem_list->mem_seg[num]),
+ &(ml->mem_seg[0]),
+ sizeof(struct Mem_Seg)
+ );
+ }
+
+ break;
+ }
+
+ default:
+ error = EINVAL;
+ break;
+
+ }
+ return(error);
+ }
+
+ #endif /* NACONF > 0 */
*** old-NetBSD/src/sys/arch/amiga/dev/ahsc.c
--- NetBSD/src/sys/arch/amiga/dev/ahsc.c
***************
*** 110,119 ****
volatile struct sdmac *rp;
struct sbic_softc *sc;
- printf("\n");
-
sc = (struct sbic_softc *)dp;
sc->sc_cregs = rp = ztwomap(0xdd0000);
/*
* disable ints and reset bank register
*/
--- 110,120 ----
volatile struct sdmac *rp;
struct sbic_softc *sc;
sc = (struct sbic_softc *)dp;
sc->sc_cregs = rp = ztwomap(0xdd0000);
+ printf (": sbic ctlr %d\n", sbic_cnt);
+ sc->sc_no = sbic_cnt++;
+
/*
* disable ints and reset bank register
*/
*** old-NetBSD/src/sys/arch/amiga/dev/atzsc.c
--- NetBSD/src/sys/arch/amiga/dev/atzsc.c
***************
*** 121,126 ****
--- 121,129 ----
sc = (struct sbic_softc *)dp;
sc->sc_cregs = rp = zap->va;
+ printf (": sbic ctlr %d", sbic_cnt);
+ sc->sc_no = sbic_cnt++;
+
/*
* disable ints and reset bank register
*/
***************
*** 158,164 ****
sc->sc_sbicp = (sbic_regmap_p) ((int)rp + 0x91);
sc->sc_clkfreq = sbic_clock_override ? sbic_clock_override : 77;
! printf(": dmamask 0x%x\n", ~sc->sc_dmamask);
sc->sc_link.adapter_softc = sc;
sc->sc_link.adapter_target = 7;
--- 161,169 ----
sc->sc_sbicp = (sbic_regmap_p) ((int)rp + 0x91);
sc->sc_clkfreq = sbic_clock_override ? sbic_clock_override : 77;
! printf(" dmamask 0x%x\n", ~sc->sc_dmamask);
!
! sbicreset(sc);
sc->sc_link.adapter_softc = sc;
sc->sc_link.adapter_target = 7;
*** old-NetBSD/src/sys/arch/amiga/dev/clock.c
--- NetBSD/src/sys/arch/amiga/dev/clock.c
***************
*** 50,55 ****
--- 50,56 ----
#include <amiga/amiga/device.h>
#include <amiga/amiga/custom.h>
#include <amiga/amiga/cia.h>
+ #include <amiga/amiga/isr.h>
#include <amiga/dev/rtc.h>
#include <amiga/dev/zbusvar.h>
***************
*** 57,62 ****
--- 58,65 ----
#include <sys/PROF.h>
#endif
+ extern void hardclock();
+
/* the clocks run at NTSC: 715.909kHz or PAL: 709.379kHz.
We're using a 100 Hz clock. */
***************
*** 65,70 ****
--- 68,80 ----
int eclockfreq;
/*
+ * The INT6 handler copies the clockframe from the stack in here as hardclock
+ * may be delayed by the IPL-remapping code. At that time the original stack
+ * location will no longer be valid.
+ */
+ struct clockframe hardclock_frame;
+
+ /*
* Machine-dependent clock routines.
*
* Startrtclock restarts the real-time clock, which provides
***************
*** 137,145 ****
--- 147,168 ----
ciab.tahi = interval >> 8;
}
+ int
+ clockintr ()
+ {
+ /* Is it a timer A interrupt? */
+ if (ciab.icr & 1) {
+ hardclock(&hardclock_frame);
+ return 1;
+ }
+ return 0;
+ }
+
void
cpu_initclocks()
{
+ static struct isr isr;
+
/*
* enable interrupts for timer A
*/
***************
*** 150,159 ****
*/
ciab.cra = (ciab.cra & 0xc0) | 1;
! /*
! * and globally enable interrupts for ciab
! */
! custom.intena = INTF_SETCLR | INTF_EXTER;
}
setstatclockrate(hz)
--- 173,182 ----
*/
ciab.cra = (ciab.cra & 0xc0) | 1;
! isr.isr_intr = clockintr;
! isr.isr_ipl = 6;
! isr.isr_mapped_ipl = 4;
! add_isr(&isr);
}
setstatclockrate(hz)
***************
*** 213,219 ****
/*
* set timer B in "count timer A underflows" mode
! * set tiemr A in one-shot mode
*/
ciaa.crb = (ciaa.crb & 0x80) | 0x48;
ciaa.cra = (ciaa.cra & 0xc0) | 0x08;
--- 236,242 ----
/*
* set timer B in "count timer A underflows" mode
! * set timer A in one-shot mode
*/
ciaa.crb = (ciaa.crb & 0x80) | 0x48;
ciaa.cra = (ciaa.cra & 0xc0) | 0x08;
*** old-NetBSD/src/sys/arch/amiga/dev/fd.c
--- NetBSD/src/sys/arch/amiga/dev/fd.c
***************
*** 481,488 ****
return(EBADF);
switch (cmd) {
- case DIOCSBAD:
- return(EINVAL);
case DIOCSRETRIES:
if (*(int *)addr < 0)
return(EINVAL);
--- 481,486 ----
*** old-NetBSD/src/sys/arch/amiga/dev/grf_cc.c
--- NetBSD/src/sys/arch/amiga/dev/grf_cc.c
***************
*** 89,95 ****
if (matchname("grfcc", mainbus_name) == 0)
return(0);
if (amiga_realconfig == 0 || ccconunit != cfp->cf_unit) {
! if (grfcc_probe() == 0)
return(0);
viewprobe();
/*
--- 89,95 ----
if (matchname("grfcc", mainbus_name) == 0)
return(0);
if (amiga_realconfig == 0 || ccconunit != cfp->cf_unit) {
! if (grf_probe() == 0)
return(0);
viewprobe();
/*
*** old-NetBSD/src/sys/arch/amiga/dev/grf_rt.c
--- NetBSD/src/sys/arch/amiga/dev/grf_rt.c
***************
*** 76,84 ****
* results from the agreements between MS and me.
*/
! extern unsigned char kernel_font_8x8_width, kernel_font_8x8_height;
! extern unsigned char kernel_font_8x8_lo, kernel_font_8x8_hi;
! extern unsigned char kernel_font_8x8[];
#define MDF_DBL 1
--- 76,84 ----
* results from the agreements between MS and me.
*/
! extern unsigned char kernel_font_width, kernel_font_height;
! extern unsigned char kernel_font_lo, kernel_font_hi;
! extern unsigned char kernel_font[];
#define MDF_DBL 1
***************
*** 89,111 ****
/* standard-palette definition */
unsigned char NCRStdPalette[16*3] = {
! /* R G B */
! 0, 0, 0,
! 192,192,192,
! 128, 0, 0,
! 0,128, 0,
! 0, 0,128,
! 128,128, 0,
! 0,128,128,
! 128, 0,128,
! 64, 64, 64, /* the higher 8 colors have more intensity for */
! 255,255,255, /* compatibility with standard attributes */
! 255, 0, 0,
! 0,255, 0,
! 0, 0,255,
! 255,255, 0,
! 0,255,255,
! 255, 0,255
};
--- 89,111 ----
/* standard-palette definition */
unsigned char NCRStdPalette[16*3] = {
! /* R G B */
! 0x00, 0x00, 0x00,
! 0x60, 0x60, 0x60,
! 0x80, 0x00, 0x00,
! 0x00, 0x80, 0x00,
! 0x00, 0x00, 0x80,
! 0x80, 0x80, 0x00,
! 0x00, 0x80, 0x80,
! 0x80, 0x00, 0x80,
! 0x40, 0x40, 0x40, /* the higher 8 colors have more intensity for */
! 0xff, 0xff, 0xff, /* compatibility with standard attributes */
! 0xff, 0x00, 0x00,
! 0x00, 0xff, 0x00,
! 0x00, 0x00, 0xff,
! 0xff, 0xff, 0x00,
! 0x00, 0xff, 0xff,
! 0xff, 0x00, 0xff,
};
***************
*** 135,180 ****
/* FQ FLG MW MH HBS HSS HSE HBE HT VBS VSS VSE VBE VT */
struct MonDef MON_640_512_60 = { 50000000, 28, 640, 512, 81, 86, 93, 98, 95, 513, 513, 521, 535, 535,
/* Depth, PAL, TX, TY, XY,FontX, FontY, FontData, FLo, Fhi */
! 4, NCRStdPalette, 80, 64, 5120, 8, 8, kernel_font_8x8, 32, 255};
struct MonDef MON_640_480_62_G = { 50000000, 4, 640, 480, 161,171,184,196,195, 481, 484, 492, 502, 502,
! 8, NCRStdPalette,640,480, 5120, 8, 8, kernel_font_8x8, 32, 255};
/* Enter higher values here ^ ^ for panning! */
/* horizontal 38kHz */
struct MonDef MON_768_600_60 = { 75000000, 28, 768, 600, 97, 99,107,120,117, 601, 615, 625, 638, 638,
! 4, NCRStdPalette, 96, 75, 7200, 8, 8, kernel_font_8x8, 32, 255};
/* horizontal 64kHz */
struct MonDef MON_768_600_80 = { 50000000, 24, 768, 600, 97,104,112,122,119, 601, 606, 616, 628, 628,
! 4, NCRStdPalette, 96, 75, 7200, 8, 8, kernel_font_8x8, 32, 255};
struct MonDef MON_1024_768_80 = { 90000000, 24, 1024, 768, 129,130,141,172,169, 769, 770, 783, 804, 804,
! 4, NCRStdPalette,128, 96, 12288, 8, 8, kernel_font_8x8, 32, 255};
/* FQ FLG MW MH HBS HSS HSE HBE HT VBS VSS VSE VBE VT */
struct MonDef MON_1024_768_80_G = { 90000000, 0, 1024, 768, 257,258,280,344,343, 769, 770, 783, 804, 804,
! 8, NCRStdPalette, 1024, 768, 12288, 8, 8, kernel_font_8x8, 32, 255};
struct MonDef MON_1024_1024_59= { 90000000, 24, 1024,1024, 129,130,141,173,170,1025,1059,1076,1087,1087,
! 4, NCRStdPalette,128, 128, 16384, 8, 8, kernel_font_8x8, 32, 255};
/* WARNING: THE FOLLOWING MONITOR MODES EXCEED THE 90-MHz LIMIT THE PROCESSOR
HAS BEEN SPECIFIED FOR. USE AT YOUR OWN RISK (AND THINK ABOUT
MOUNTING SOME COOLING DEVICE AT THE PROCESSOR AND RAMDAC)! */
struct MonDef MON_1280_1024_60= {110000000, 24, 1280,1024, 161,162,176,211,208,1025,1026,1043,1073,1073,
! 4, NCRStdPalette,160, 128, 20480, 8, 8, kernel_font_8x8, 32, 255};
struct MonDef MON_1280_1024_60_G= {110000000, 0, 1280,1024, 321,322,349,422,421,1025,1026,1043,1073,1073,
! 8, NCRStdPalette,1280,1024, 20480, 8, 8, kernel_font_8x8, 32, 255};
/* horizontal 75kHz */
struct MonDef MON_1280_1024_69= {120000000, 24, 1280,1024, 161,162,175,200,197,1025,1026,1043,1073,1073,
! 4, NCRStdPalette,160, 128, 20480, 8, 8, kernel_font_8x8, 32, 255};
#else
--- 135,180 ----
/* FQ FLG MW MH HBS HSS HSE HBE HT VBS VSS VSE VBE VT */
struct MonDef MON_640_512_60 = { 50000000, 28, 640, 512, 81, 86, 93, 98, 95, 513, 513, 521, 535, 535,
/* Depth, PAL, TX, TY, XY,FontX, FontY, FontData, FLo, Fhi */
! 4, NCRStdPalette, 80, 64, 5120, 8, 8, kernel_font, 32, 255};
struct MonDef MON_640_480_62_G = { 50000000, 4, 640, 480, 161,171,184,196,195, 481, 484, 492, 502, 502,
! 8, NCRStdPalette,640,480, 5120, 8, 8, kernel_font, 32, 255};
/* Enter higher values here ^ ^ for panning! */
/* horizontal 38kHz */
struct MonDef MON_768_600_60 = { 75000000, 28, 768, 600, 97, 99,107,120,117, 601, 615, 625, 638, 638,
! 4, NCRStdPalette, 96, 75, 7200, 8, 8, kernel_font, 32, 255};
/* horizontal 64kHz */
struct MonDef MON_768_600_80 = { 50000000, 24, 768, 600, 97,104,112,122,119, 601, 606, 616, 628, 628,
! 4, NCRStdPalette, 96, 75, 7200, 8, 8, kernel_font, 32, 255};
struct MonDef MON_1024_768_80 = { 90000000, 24, 1024, 768, 129,130,141,172,169, 769, 770, 783, 804, 804,
! 4, NCRStdPalette,128, 96, 12288, 8, 8, kernel_font, 32, 255};
/* FQ FLG MW MH HBS HSS HSE HBE HT VBS VSS VSE VBE VT */
struct MonDef MON_1024_768_80_G = { 90000000, 0, 1024, 768, 257,258,280,344,343, 769, 770, 783, 804, 804,
! 8, NCRStdPalette, 1024, 768, 12288, 8, 8, kernel_font, 32, 255};
struct MonDef MON_1024_1024_59= { 90000000, 24, 1024,1024, 129,130,141,173,170,1025,1059,1076,1087,1087,
! 4, NCRStdPalette,128, 128, 16384, 8, 8, kernel_font, 32, 255};
/* WARNING: THE FOLLOWING MONITOR MODES EXCEED THE 90-MHz LIMIT THE PROCESSOR
HAS BEEN SPECIFIED FOR. USE AT YOUR OWN RISK (AND THINK ABOUT
MOUNTING SOME COOLING DEVICE AT THE PROCESSOR AND RAMDAC)! */
struct MonDef MON_1280_1024_60= {110000000, 24, 1280,1024, 161,162,176,211,208,1025,1026,1043,1073,1073,
! 4, NCRStdPalette,160, 128, 20480, 8, 8, kernel_font, 32, 255};
struct MonDef MON_1280_1024_60_G= {110000000, 0, 1280,1024, 321,322,349,422,421,1025,1026,1043,1073,1073,
! 8, NCRStdPalette,1280,1024, 20480, 8, 8, kernel_font, 32, 255};
/* horizontal 75kHz */
struct MonDef MON_1280_1024_69= {120000000, 24, 1280,1024, 161,162,175,200,197,1025,1026,1043,1073,1073,
! 4, NCRStdPalette,160, 128, 20480, 8, 8, kernel_font, 32, 255};
#else
***************
*** 182,225 ****
/* horizontal 31.5 kHz */
{ 50000000, 28, 640, 512, 81, 86, 93, 98, 95, 513, 513, 521, 535, 535,
! 4, NCRStdPalette, 80, 64, 5120, 8, 8, kernel_font_8x8, 32, 255},
/* horizontal 38kHz */
{ 75000000, 28, 768, 600, 97, 99,107,120,117, 601, 615, 625, 638, 638,
! 4, NCRStdPalette, 96, 75, 7200, 8, 8, kernel_font_8x8, 32, 255},
/* horizontal 64kHz */
{ 50000000, 24, 768, 600, 97,104,112,122,119, 601, 606, 616, 628, 628,
! 4, NCRStdPalette, 96, 75, 7200, 8, 8, kernel_font_8x8, 32, 255},
{ 90000000, 24, 1024, 768, 129,130,141,172,169, 769, 770, 783, 804, 804,
! 4, NCRStdPalette,128, 96, 12288, 8, 8, kernel_font_8x8, 32, 255},
/* GFX modes */
/* horizontal 31.5 kHz */
{ 50000000, 4, 640, 480, 161,171,184,196,195, 481, 484, 492, 502, 502,
! 8, NCRStdPalette,640, 480, 5120, 8, 8, kernel_font_8x8, 32, 255},
/* horizontal 64kHz */
{ 90000000, 0, 1024, 768, 257,258,280,344,343, 769, 770, 783, 804, 804,
! 8, NCRStdPalette, 1024, 768, 12288, 8, 8, kernel_font_8x8, 32, 255},
/* WARNING: THE FOLLOWING MONITOR MODES EXCEED THE 90-MHz LIMIT THE PROCESSOR
HAS BEEN SPECIFIED FOR. USE AT YOUR OWN RISK (AND THINK ABOUT
MOUNTING SOME COOLING DEVICE AT THE PROCESSOR AND RAMDAC)! */
{110000000, 0, 1280,1024, 321,322,349,422,421,1025,1026,1043,1073,1073,
! 8, NCRStdPalette,1280,1024, 20480, 8, 8, kernel_font_8x8, 32, 255},
};
static const char *monitor_descr[] = {
"80x64 (640x512) 31.5kHz",
"96x75 (768x600) 38kHz",
"96x75 (768x600) 64kHz",
"128x96 (1024x768) 64kHz",
--- 182,234 ----
/* horizontal 31.5 kHz */
{ 50000000, 28, 640, 512, 81, 86, 93, 98, 95, 513, 513, 521, 535, 535,
! 4, NCRStdPalette, 80, 64, 5120, 8, 8, kernel_font, 32, 255},
/* horizontal 38kHz */
{ 75000000, 28, 768, 600, 97, 99,107,120,117, 601, 615, 625, 638, 638,
! 4, NCRStdPalette, 96, 75, 7200, 8, 8, kernel_font, 32, 255},
!
! /* horizontal 50kHz */
!
! { 65000000, 24, 1024, 768, 129,130,140,160,157, 769, 770, 783, 807, 807,
! 4, NCRStdPalette,128, 96, 12288, 8, 8, kernel_font, 32, 255},
! { 90000000, 24, 1264,1008, 159,160,174,219,216,1009,1010,1027,1056,1056,
! 4, NCRStdPalette,158, 126, 19908, 8, 8, kernel_font, 32, 255},
/* horizontal 64kHz */
{ 50000000, 24, 768, 600, 97,104,112,122,119, 601, 606, 616, 628, 628,
! 4, NCRStdPalette, 96, 75, 7200, 8, 8, kernel_font, 32, 255},
{ 90000000, 24, 1024, 768, 129,130,141,172,169, 769, 770, 783, 804, 804,
! 4, NCRStdPalette,128, 96, 12288, 8, 8, kernel_font, 32, 255},
/* GFX modes */
/* horizontal 31.5 kHz */
{ 50000000, 4, 640, 480, 161,171,184,196,195, 481, 484, 492, 502, 502,
! 8, NCRStdPalette,640, 480, 5120, 8, 8, kernel_font, 32, 255},
/* horizontal 64kHz */
{ 90000000, 0, 1024, 768, 257,258,280,344,343, 769, 770, 783, 804, 804,
! 8, NCRStdPalette, 1024, 768, 12288, 8, 8, kernel_font, 32, 255},
/* WARNING: THE FOLLOWING MONITOR MODES EXCEED THE 90-MHz LIMIT THE PROCESSOR
HAS BEEN SPECIFIED FOR. USE AT YOUR OWN RISK (AND THINK ABOUT
MOUNTING SOME COOLING DEVICE AT THE PROCESSOR AND RAMDAC)! */
{110000000, 0, 1280,1024, 321,322,349,422,421,1025,1026,1043,1073,1073,
! 8, NCRStdPalette,1280,1024, 20480, 8, 8, kernel_font, 32, 255},
};
static const char *monitor_descr[] = {
"80x64 (640x512) 31.5kHz",
"96x75 (768x600) 38kHz",
+ "128x96 (1024x768) 50kHz",
+ "158x126 (1264x1008) 50kHz",
"96x75 (768x600) 64kHz",
"128x96 (1024x768) 64kHz",
***************
*** 232,238 ****
/* patchable */
int retina_default_mon = 0;
! int retina_default_gfx = 4;
#endif
--- 241,247 ----
/* patchable */
int retina_default_mon = 0;
! int retina_default_gfx = 6;
#endif
*** old-NetBSD/src/sys/arch/amiga/dev/grfabs.c
--- NetBSD/src/sys/arch/amiga/dev/grfabs.c
***************
*** 45,55 ****
--- 45,59 ----
*/
/* add your monitor here. */
+ #if NGRFCC > 0
monitor_t *cc_init_monitor (void);
+ #endif /* NGRFCC > 0 */
/* and here. */
monitor_t *(*init_monitor[])(void) = {
+ #if NGRFCC > 0
cc_init_monitor,
+ #endif /* NGRFCC > 0 */
NULL
};
***************
*** 76,87 ****
}
/*
! * XXX: called from ite console init routine.
* Does just what configure will do later but without printing anything.
*/
int
! grfcc_probe()
{
int i = 0;
--- 80,91 ----
}
/*
! * XXX: called from grf_cc probe routine.
* Does just what configure will do later but without printing anything.
*/
int
! grf_probe()
{
int i = 0;
***************
*** 114,119 ****
--- 118,126 ----
dimen_t dim;
long dx, dy, ct, dt;
+ if (monitors == NULL)
+ return NULL;
+
save = NULL;
for (m = monitors->lh_first; m != NULL; m = m->link.le_next) {
dim.width = width;
*** old-NetBSD/src/sys/arch/amiga/dev/grfabs_cc.c
--- NetBSD/src/sys/arch/amiga/dev/grfabs_cc.c
***************
*** 35,40 ****
--- 35,43 ----
*
*/
+ #include "grfcc.h"
+ #if NGRFCC > 0
+
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/cdefs.h>
***************
*** 3113,3115 ****
--- 3116,3119 ----
#endif /* GRF_AGA */
#endif /* GRF_PAL */
+ #endif /* NGRFCC > 0 */
*** old-NetBSD/src/sys/arch/amiga/dev/gtsc.c
--- NetBSD/src/sys/arch/amiga/dev/gtsc.c
***************
*** 119,124 ****
--- 119,126 ----
gap = auxp;
sc = (struct sbic_softc *)dp;
sc->sc_cregs = rp = gap->zargs.va;
+ printf (": sbic ctlr %d", sbic_cnt);
+ sc->sc_no = sbic_cnt++;
/*
* disable ints and reset bank register
***************
*** 147,153 ****
sc->sc_dmamask = ~0x01ffffff;
else
sc->sc_dmamask = ~0x07ffffff;
! printf(": dmamask 0x%x", ~sc->sc_dmamask);
if ((gap->flags & GVP_NOBANK) == 0)
sc->gtsc_bankmask = (~sc->sc_dmamask >> 18) & 0x01c0;
--- 149,155 ----
sc->sc_dmamask = ~0x01ffffff;
else
sc->sc_dmamask = ~0x07ffffff;
! printf(" dmamask 0x%x", ~sc->sc_dmamask);
if ((gap->flags & GVP_NOBANK) == 0)
sc->gtsc_bankmask = (~sc->sc_dmamask >> 18) & 0x01c0;
***************
*** 385,395 ****
int s;
s = splbio();
! if (sc->sc_dmatimo) {
! if (sc->sc_dmatimo > 1)
printf("%s: dma timeout #%d\n",
! sc->sc_dev.dv_xname, sc->sc_dmatimo - 1);
! sc->sc_dmatimo++;
}
splx(s);
timeout((void *)gtsc_dmatimeout, sc, 30 * hz);
--- 387,397 ----
int s;
s = splbio();
! if (dev->sc_dmatimo) {
! if (dev->sc_dmatimo > 1)
printf("%s: dma timeout #%d\n",
! sc->sc_dev.dv_xname, dev->sc_dmatimo - 1);
! dev->sc_dmatimo++;
}
splx(s);
timeout((void *)gtsc_dmatimeout, sc, 30 * hz);
*** old-NetBSD/src/sys/arch/amiga/dev/gtscreg.h
--- NetBSD/src/sys/arch/amiga/dev/gtscreg.h
***************
*** 34,41 ****
*
* @(#)gvp11_dmareg.h
*/
! #ifndef _AMIGA_DEV_AHSCREG_H_
! #define _AMIGA_DEV_AHSCREG_H_
/*
* Hardware layout of the GVP Series II SDMAC. This also contains the
--- 34,41 ----
*
* @(#)gvp11_dmareg.h
*/
! #ifndef _AMIGA_DEV_GTSCREG_H_
! #define _AMIGA_DEV_GTSCREG_H_
/*
* Hardware layout of the GVP Series II SDMAC. This also contains the
***************
*** 72,75 ****
#define GVP_CNTR_INTEN (1<<3)
#define GVP_CNTR_DDIR (1<<4)
! #endif /* _AMIGA_DEV_AHSCREG_H_ */
--- 72,75 ----
#define GVP_CNTR_INTEN (1<<3)
#define GVP_CNTR_DDIR (1<<4)
! #endif /* _AMIGA_DEV_GTSCREG_H_ */
*** old-NetBSD/src/sys/arch/amiga/dev/if_ed.c
--- /dev/null Tue Aug 22 20:27:16 1995
***************
*** 1,1238 ****
- /* $NetBSD: if_ed.c,v 1.15 1995/08/20 02:52:48 chopps Exp $ */
-
- /*
- * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
- * adapters.
- *
- * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
- *
- * Copyright (C) 1993, David Greenman. This software may be used, modified,
- * copied, distributed, and sold, in both source and binary form provided that
- * the above copyright and these terms are retained. Under no circumstances is
- * the author responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with its use.
- *
- * Currently supports the Hydra Systems ethernet card.
- */
-
- #include "bpfilter.h"
-
- #include <sys/param.h>
- #include <sys/systm.h>
- #include <sys/errno.h>
- #include <sys/ioctl.h>
- #include <sys/mbuf.h>
- #include <sys/socket.h>
- #include <sys/syslog.h>
- #include <sys/device.h>
-
- #include <net/if.h>
- #include <net/if_dl.h>
- #include <net/if_types.h>
- #include <net/netisr.h>
-
- #ifdef INET
- #include <netinet/in.h>
- #include <netinet/in_systm.h>
- #include <netinet/in_var.h>
- #include <netinet/ip.h>
- #include <netinet/if_ether.h>
- #endif
-
- #ifdef NS
- #include <netns/ns.h>
- #include <netns/ns_if.h>
- #endif
-
- #if NBPFILTER > 0
- #include <net/bpf.h>
- #include <net/bpfdesc.h>
- #endif
-
- #include <machine/cpu.h>
- #include <machine/mtpr.h>
-
- #include <amiga/amiga/device.h>
- #include <amiga/amiga/isr.h>
- #include <amiga/dev/zbusvar.h>
- #include <dev/ic/dp8390reg.h>
- #include <amiga/dev/if_edreg.h>
-
- #define HYDRA_MANID 2121
- #define HYDRA_PRODID 1
-
- #define ASDG_MANID 1023
- #define ASDG_PRODID 254
-
- /*
- * ed_softc: per line info and status
- */
- struct ed_softc {
- struct device sc_dev;
- struct isr sc_isr;
-
- struct arpcom sc_arpcom; /* ethernet common */
-
- u_char volatile *nic_addr; /* NIC (DS8390) I/O address */
-
- u_char cr_proto; /* values always set in CR */
-
- caddr_t mem_start; /* NIC memory start address */
- caddr_t mem_end; /* NIC memory end address */
- u_long mem_size; /* total NIC memory size */
- caddr_t mem_ring; /* start of RX ring-buffer (in NIC mem) */
-
- u_char xmit_busy; /* transmitter is busy */
- u_char txb_cnt; /* number of transmit buffers */
- u_char txb_inuse; /* number of TX buffers currently in-use*/
-
- u_char txb_new; /* pointer to where new buffer will be added */
- u_char txb_next_tx; /* pointer to next buffer ready to xmit */
- u_short txb_len[8]; /* buffered xmit buffer lengths */
- u_char tx_page_start; /* first page of TX buffer area */
- u_char rec_page_start; /* first page of RX ring-buffer */
- u_char rec_page_stop; /* last page of RX ring-buffer */
- u_char next_packet; /* pointer to next unread RX packet */
- };
-
- int edmatch __P((struct device *, void *, void *));
- void edattach __P((struct device *, struct device *, void *));
- int edintr __P((struct ed_softc *));
- int ed_ioctl __P((struct ifnet *, u_long, caddr_t));
- void ed_start __P((struct ifnet *));
- void ed_watchdog __P((/* short */));
- void ed_reset __P((struct ed_softc *));
- void ed_init __P((struct ed_softc *));
- void ed_stop __P((struct ed_softc *));
- void ed_getmcaf __P((struct arpcom *, u_long *));
- u_short ed_put __P((struct ed_softc *, struct mbuf *, caddr_t));
-
- #define inline /* XXX for debugging porpoises */
-
- void ed_get_packet __P((/* struct ed_softc *, caddr_t, u_short */));
- static inline void ed_rint __P((struct ed_softc *));
- static inline void ed_xmit __P((struct ed_softc *));
- static inline caddr_t ed_ring_copy __P((/* struct ed_softc *, caddr_t, caddr_t,
- u_short */));
-
- struct cfdriver edcd = {
- NULL, "ed", edmatch, edattach, DV_IFNET, sizeof(struct ed_softc)
- };
-
- #define ETHER_MIN_LEN 64
- #define ETHER_MAX_LEN 1518
- #define ETHER_ADDR_LEN 6
-
- static inline void
- NIC_PUT(sc, off, val)
- struct ed_softc *sc;
- int off;
- u_char val;
- {
- sc->nic_addr[off * 2] = val;
- #ifdef not_def
- /*
- * This was being used to *slow* access to the bus. I don't
- * believe it is needed but I'll leave it around incase probelms
- * pop-up
- */
- (void)ciaa.pra;
- #endif
- }
-
- static inline u_char
- NIC_GET(sc, off)
- struct ed_softc *sc;
- int off;
- {
- register u_char val;
-
- val = sc->nic_addr[off * 2];
- #ifdef not_def
- /*
- * This was being used to *slow* access to the bus. I don't
- * believe it is needed but I'll leave it around incase probelms
- * pop-up
- */
- (void)ciaa.pra;
- #endif
- return (val);
- }
-
- /*
- * Memory copy, copies word at time.
- */
- static inline void
- word_copy(a, b, len)
- caddr_t a, b;
- int len;
- {
- u_short *x = (u_short *)a,
- *y = (u_short *)b;
-
- len >>= 1;
- while (len--)
- *y++ = *x++;
- }
-
- int
- edmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
- {
- struct zbus_args *zap = aux;
-
- if (zap->manid == HYDRA_MANID && zap->prodid == HYDRA_PRODID)
- return (1);
- else if (zap->manid == ASDG_MANID && zap->prodid == ASDG_PRODID)
- return (1);
- return (0);
- }
-
- void
- edattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
- {
- struct ed_softc *sc = (void *)self;
- struct zbus_args *zap = aux;
- struct cfdata *cf = sc->sc_dev.dv_cfdata;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- u_char *prom;
- int i;
-
- if (zap->manid == HYDRA_MANID) {
- sc->mem_start = zap->va;
- sc->nic_addr = sc->mem_start + HYDRA_NIC_BASE;
- prom = (u_char *)sc->mem_start + HYDRA_ADDRPROM;
- } else {
- sc->mem_start = zap->va + 0x8000;
- sc->nic_addr = zap->va + ASDG_NIC_BASE;
- prom = (u_char *)sc->nic_addr + ASDG_ADDRPROM;
- }
- sc->cr_proto = ED_CR_RD2;
- sc->tx_page_start = 0;
-
- #define memsize 16384
-
- sc->mem_size = memsize;
- sc->mem_end = sc->mem_start + memsize;
-
- /*
- * Use one xmit buffer if < 16k, two buffers otherwise (if not told
- * otherwise).
- */
- if ((memsize < 16384) || (cf->cf_flags & ED_FLAGS_NO_MULTI_BUFFERING))
- sc->txb_cnt = 1;
- else
- sc->txb_cnt = 2;
-
- sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
- sc->rec_page_stop = sc->tx_page_start + (memsize >> ED_PAGE_SHIFT);
-
- sc->mem_ring =
- sc->mem_start + ((sc->txb_cnt * ED_TXBUF_SIZE) << ED_PAGE_SHIFT);
-
- #undef memsize
-
- /*
- * read the ethernet address from the board
- */
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- sc->sc_arpcom.ac_enaddr[i] = *(prom + 2 * i);
-
- /* Set interface to stopped condition (reset). */
- ed_stop(sc);
-
- /* Initialize ifnet structure. */
- ifp->if_unit = sc->sc_dev.dv_unit;
- ifp->if_name = edcd.cd_name;
- ifp->if_start = ed_start;
- ifp->if_ioctl = ed_ioctl;
- ifp->if_watchdog = ed_watchdog;
- ifp->if_flags =
- IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
-
- /* Attach the interface. */
- if_attach(ifp);
- ether_ifattach(ifp);
-
- /* Print additional info when attached. */
- printf(": address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr));
-
- #if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
- #endif
-
- sc->sc_isr.isr_intr = edintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = 2;
- add_isr(&sc->sc_isr);
- }
-
- /*
- * Reset interface.
- */
- void
- ed_reset(sc)
- struct ed_softc *sc;
- {
- int s;
-
- s = splimp();
- ed_stop(sc);
- ed_init(sc);
- splx(s);
- log(LOG_ERR, "%s: reset\n", sc->sc_dev.dv_xname);
- }
-
- /*
- * Take interface offline.
- */
- void
- ed_stop(sc)
- struct ed_softc *sc;
- {
- int n = 5000;
-
- /* Stop everything on the interface, and select page 0 registers. */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
-
- /*
- * Wait for interface to enter stopped state, but limit # of checks to
- * 'n' (about 5ms). It shouldn't even take 5us on modern DS8390's, but
- * just in case it's an old one.
- */
- while (((NIC_GET(sc, ED_P0_ISR) & ED_ISR_RST) == 0) && --n);
- }
-
- /*
- * Device timeout/watchdog routine. Entered if the device neglects to generate
- * an interrupt after a transmit has been started on it.
- */
- void
- ed_watchdog(unit)
- short unit;
- {
- struct ed_softc *sc = edcd.cd_devs[unit];
-
- log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
- ++sc->sc_arpcom.ac_if.if_oerrors;
-
- ed_reset(sc);
- }
-
- /*
- * Initialize device.
- */
- void
- ed_init(sc)
- struct ed_softc *sc;
- {
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- int i, s;
- u_char command;
- u_long mcaf[2];
-
- /*
- * Initialize the NIC in the exact order outlined in the NS manual.
- * This init procedure is "mandatory"...don't change what or when
- * things happen.
- */
- s = splimp();
-
- /* Reset transmitter flags. */
- sc->xmit_busy = 0;
- sc->sc_arpcom.ac_if.if_timer = 0;
-
- sc->txb_inuse = 0;
- sc->txb_new = 0;
- sc->txb_next_tx = 0;
-
- /* Set interface for page 0, remote DMA complete, stopped. */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
-
- /*
- * Set FIFO threshold to 8, No auto-init Remote DMA, byte
- * order=68k, word-wide DMA xfers,
- * XXX changed to use 2 word threshhold
- */
- NIC_PUT(sc, ED_P0_DCR,
- ED_DCR_FT0 | ED_DCR_WTS | ED_DCR_LS | ED_DCR_BOS);
-
- /* Clear remote byte count registers. */
- NIC_PUT(sc, ED_P0_RBCR0, 0);
- NIC_PUT(sc, ED_P0_RBCR1, 0);
-
- /* Tell RCR to do nothing for now. */
- NIC_PUT(sc, ED_P0_RCR, ED_RCR_MON);
-
- /* Place NIC in internal loopback mode. */
- NIC_PUT(sc, ED_P0_TCR, ED_TCR_LB0);
-
- /* Initialize receive buffer ring. */
- NIC_PUT(sc, ED_P0_BNRY, sc->rec_page_start);
- NIC_PUT(sc, ED_P0_PSTART, sc->rec_page_start);
- NIC_PUT(sc, ED_P0_PSTOP, sc->rec_page_stop);
-
- /*
- * Clear all interrupts. A '1' in each bit position clears the
- * corresponding flag.
- */
- NIC_PUT(sc, ED_P0_ISR, 0xff);
-
- /*
- * Enable the following interrupts: receive/transmit complete,
- * receive/transmit error, and Receiver OverWrite.
- *
- * Counter overflow and Remote DMA complete are *not* enabled.
- */
- NIC_PUT(sc, ED_P0_IMR,
- ED_IMR_PRXE | ED_IMR_PTXE | ED_IMR_RXEE | ED_IMR_TXEE |
- ED_IMR_OVWE);
-
- /* Program command register for page 1. */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP);
-
- /* Copy out our station address. */
- for (i = 0; i < ETHER_ADDR_LEN; ++i)
- NIC_PUT(sc, ED_P1_PAR0 + i, sc->sc_arpcom.ac_enaddr[i]);
-
- /* Set multicast filter on chip. */
- ed_getmcaf(&sc->sc_arpcom, mcaf);
- for (i = 0; i < 8; i++)
- NIC_PUT(sc, ED_P1_MAR0 + i, ((u_char *)mcaf)[i]);
-
- /*
- * Set current page pointer to one page after the boundary pointer, as
- * recommended in the National manual.
- */
- sc->next_packet = sc->rec_page_start + 1;
- NIC_PUT(sc, ED_P1_CURR, sc->next_packet);
-
- /* Program command register for page 0. */
- NIC_PUT(sc, ED_P1_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
-
- i = ED_RCR_AB | ED_RCR_AM;
- if (ifp->if_flags & IFF_PROMISC) {
- /*
- * Set promiscuous mode. Multicast filter was set earlier so
- * that we should receive all multicast packets.
- */
- i |= ED_RCR_PRO | ED_RCR_AR | ED_RCR_SEP;
- }
- NIC_PUT(sc, ED_P0_RCR, i);
-
- /* Take interface out of loopback. */
- NIC_PUT(sc, ED_P0_TCR, 0);
-
- /* Fire up the interface. */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
-
- /* Set 'running' flag, and clear output active flag. */
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- /* ...and attempt to start output. */
- ed_start(ifp);
-
- splx(s);
- }
-
- /*
- * This routine actually starts the transmission on the interface.
- */
- static inline void
- ed_xmit(sc)
- struct ed_softc *sc;
- {
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- u_short len;
-
- len = sc->txb_len[sc->txb_next_tx];
-
- /* Set NIC for page 0 register access. */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
-
- /* Set TX buffer start page. */
- NIC_PUT(sc, ED_P0_TPSR, sc->tx_page_start +
- sc->txb_next_tx * ED_TXBUF_SIZE);
-
- /* Set TX length. */
- NIC_PUT(sc, ED_P0_TBCR0, len);
- NIC_PUT(sc, ED_P0_TBCR1, len >> 8);
-
- /* Set page 0, remote DMA complete, transmit packet, and *start*. */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_TXP | ED_CR_STA);
- sc->xmit_busy = 1;
-
- /* Point to next transmit buffer slot and wrap if necessary. */
- sc->txb_next_tx++;
- if (sc->txb_next_tx == sc->txb_cnt)
- sc->txb_next_tx = 0;
-
- /* Set a timer just in case we never hear from the board again. */
- ifp->if_timer = 2;
- }
-
- /*
- * Start output on interface.
- * We make two assumptions here:
- * 1) that the current priority is set to splimp _before_ this code
- * is called *and* is returned to the appropriate priority after
- * return
- * 2) that the IFF_OACTIVE flag is checked before this code is called
- * (i.e. that the output part of the interface is idle)
- */
- void
- ed_start(ifp)
- struct ifnet *ifp;
- {
- struct ed_softc *sc = edcd.cd_devs[ifp->if_unit];
- struct mbuf *m0, *m;
- caddr_t buffer;
- int len;
-
- outloop:
- /*
- * First, see if there are buffered packets and an idle transmitter -
- * should never happen at this point.
- */
- if (sc->txb_inuse && (sc->xmit_busy == 0)) {
- printf("%s: packets buffered, but transmitter idle\n",
- sc->sc_dev.dv_xname);
- ed_xmit(sc);
- }
-
- /* See if there is room to put another packet in the buffer. */
- if (sc->txb_inuse == sc->txb_cnt) {
- /* No room. Indicate this to the outside world and exit. */
- ifp->if_flags |= IFF_OACTIVE;
- return;
- }
-
- IF_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m);
- if (m == 0) {
- /*
- * We are using the !OACTIVE flag to indicate to the outside
- * world that we can accept an additional packet rather than
- * that the transmitter is _actually_ active. Indeed, the
- * transmitter may be active, but if we haven't filled all the
- * buffers with data then we still want to accept more.
- */
- ifp->if_flags &= ~IFF_OACTIVE;
- return;
- }
-
- /* Copy the mbuf chain into the transmit buffer. */
- m0 = m;
-
- /* txb_new points to next open buffer slot. */
- buffer = sc->mem_start + ((sc->txb_new * ED_TXBUF_SIZE) << ED_PAGE_SHIFT);
-
- len = ed_put(sc, m, buffer);
-
- sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN);
- sc->txb_inuse++;
-
- /* Point to next buffer slot and wrap if necessary. */
- if (++sc->txb_new == sc->txb_cnt)
- sc->txb_new = 0;
-
- if (sc->xmit_busy == 0)
- ed_xmit(sc);
-
- #if NBPFILTER > 0
- /* Tap off here if there is a BPF listener. */
- if (sc->sc_arpcom.ac_if.if_bpf)
- bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m0);
- #endif
-
- m_freem(m0);
-
- /* Loop back to the top to possibly buffer more packets. */
- goto outloop;
- }
-
- /*
- * Ethernet interface receiver interrupt.
- */
- static inline void
- ed_rint(sc)
- struct ed_softc *sc;
- {
- u_char boundary, current;
- u_short len;
- u_char nlen;
- struct ed_ring packet_hdr;
- caddr_t packet_ptr;
-
- loop:
- /* Set NIC to page 1 registers to get 'current' pointer. */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA);
-
- /*
- * 'sc->next_packet' is the logical beginning of the ring-buffer - i.e.
- * it points to where new data has been buffered. The 'CURR' (current)
- * register points to the logical end of the ring-buffer - i.e. it
- * points to where additional new data will be added. We loop here
- * until the logical beginning equals the logical end (or in other
- * words, until the ring-buffer is empty).
- */
- current = NIC_GET(sc, ED_P1_CURR);
- if (sc->next_packet == current)
- return;
-
- /* Set NIC to page 0 registers to update boundary register. */
- NIC_PUT(sc, ED_P1_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
-
- do {
- /* Get pointer to this buffer's header structure. */
- packet_ptr = sc->mem_ring +
- ((sc->next_packet - sc->rec_page_start) << ED_PAGE_SHIFT);
-
- /*
- * The byte count includes a 4 byte header that was added by
- * the NIC.
- */
- packet_hdr = *(struct ed_ring *)packet_ptr;
- packet_hdr.count = ((packet_hdr.count >> 8) & 0xff)
- | ((packet_hdr.count & 0xff) << 8);
- len = packet_hdr.count;
- /*
- * Try do deal with old, buggy chips that sometimes duplicate
- * the low byte of the length into the high byte. We do this
- * by simply ignoring the high byte of the length and always
- * recalculating it.
- *
- * NOTE: sc->next_packet is pointing at the current packet.
- */
- if (packet_hdr.next_packet >= sc->next_packet)
- nlen = (packet_hdr.next_packet - sc->next_packet);
- else
- nlen = ((packet_hdr.next_packet - sc->rec_page_start) +
- (sc->rec_page_stop - sc->next_packet));
- --nlen;
- if ((len & ED_PAGE_MASK) + sizeof(packet_hdr) > ED_PAGE_SIZE)
- --nlen;
- len = (len & ED_PAGE_MASK) | (nlen << ED_PAGE_SHIFT);
- #ifdef DIAGNOSTIC
- if (len != packet_hdr.count) {
- printf("%s: length does not match next packet pointer\n",
- sc->sc_dev.dv_xname);
- printf("%s: len %04x nlen %04x start %02x first %02x curr %02x next %02x stop %02x\n",
- sc->sc_dev.dv_xname, packet_hdr.count, len,
- sc->rec_page_start, sc->next_packet, current,
- packet_hdr.next_packet, sc->rec_page_stop);
- }
- #endif
-
- /*
- * Be fairly liberal about what we allow as a "reasonable"
- * length so that a [crufty] packet will make it to BPF (and
- * can thus be analyzed). Note that all that is really
- * important is that we have a length that will fit into one
- * mbuf cluster or less; the upper layer protocols can then
- * figure out the length from their own length field(s).
- *
- * MCLBYTES may be less than a valid packet len. Thus
- * we use a constant that is large enough.
- */
- if (len <= 2048 &&
- packet_hdr.next_packet >= sc->rec_page_start &&
- packet_hdr.next_packet < sc->rec_page_stop) {
- /* Go get packet. */
- ed_get_packet(sc, packet_ptr + sizeof(struct ed_ring),
- len - sizeof(struct ed_ring));
- ++sc->sc_arpcom.ac_if.if_ipackets;
- } else {
- /* Really BAD. The ring pointers are corrupted. */
- log(LOG_ERR,
- "%s: NIC memory corrupt - invalid packet length %d\n",
- sc->sc_dev.dv_xname, len);
- ++sc->sc_arpcom.ac_if.if_ierrors;
- ed_reset(sc);
- return;
- }
-
- /* Update next packet pointer. */
- sc->next_packet = packet_hdr.next_packet;
-
- /*
- * Update NIC boundary pointer - being careful to keep it one
- * buffer behind (as recommended by NS databook).
- */
- boundary = sc->next_packet - 1;
- if (boundary < sc->rec_page_start)
- boundary = sc->rec_page_stop - 1;
- NIC_PUT(sc, ED_P0_BNRY, boundary);
- } while (sc->next_packet != current);
-
- goto loop;
- }
-
- /* Ethernet interface interrupt processor. */
- int
- edintr(sc)
- struct ed_softc *sc;
- {
- u_char isr;
-
- /* Set NIC to page 0 registers. */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
-
- isr = NIC_GET(sc, ED_P0_ISR);
- if (!isr)
- return (0);
-
- /* Loop until there are no more new interrupts. */
- for (;;) {
- /*
- * Reset all the bits that we are 'acknowledging' by writing a
- * '1' to each bit position that was set.
- * (Writing a '1' *clears* the bit.)
- */
- NIC_PUT(sc, ED_P0_ISR, isr);
-
- /*
- * Handle transmitter interrupts. Handle these first because
- * the receiver will reset the board under some conditions.
- */
- if (isr & (ED_ISR_PTX | ED_ISR_TXE)) {
- u_char collisions = NIC_GET(sc, ED_P0_NCR) & 0x0f;
-
- /*
- * Check for transmit error. If a TX completed with an
- * error, we end up throwing the packet away. Really
- * the only error that is possible is excessive
- * collisions, and in this case it is best to allow the
- * automatic mechanisms of TCP to backoff the flow. Of
- * course, with UDP we're screwed, but this is expected
- * when a network is heavily loaded.
- */
- (void) NIC_GET(sc, ED_P0_TSR);
- if (isr & ED_ISR_TXE) {
- /*
- * Excessive collisions (16).
- */
- if ((NIC_GET(sc, ED_P0_TSR) & ED_TSR_ABT)
- && (collisions == 0)) {
- /*
- * When collisions total 16, the P0_NCR
- * will indicate 0, and the TSR_ABT is
- * set.
- */
- collisions = 16;
- }
-
- /* Update output errors counter. */
- ++sc->sc_arpcom.ac_if.if_oerrors;
- } else {
- /*
- * Update total number of successfully
- * transmitted packets.
- */
- ++sc->sc_arpcom.ac_if.if_opackets;
- }
-
- /* Reset TX busy and output active flags. */
- sc->xmit_busy = 0;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
-
- /* Clear watchdog timer. */
- sc->sc_arpcom.ac_if.if_timer = 0;
-
- /*
- * Add in total number of collisions on last
- * transmission.
- */
- sc->sc_arpcom.ac_if.if_collisions += collisions;
-
- /*
- * Decrement buffer in-use count if not zero (can only
- * be zero if a transmitter interrupt occured while not
- * actually transmitting).
- * If data is ready to transmit, start it transmitting,
- * otherwise defer until after handling receiver.
- */
- if (sc->txb_inuse && --sc->txb_inuse)
- ed_xmit(sc);
- }
-
- /* Handle receiver interrupts. */
- if (isr & (ED_ISR_PRX | ED_ISR_RXE | ED_ISR_OVW)) {
- /*
- * Overwrite warning. In order to make sure that a
- * lockup of the local DMA hasn't occurred, we reset
- * and re-init the NIC. The NSC manual suggests only a
- * partial reset/re-init is necessary - but some chips
- * seem to want more. The DMA lockup has been seen
- * only with early rev chips - Methinks this bug was
- * fixed in later revs. -DG
- */
- if (isr & ED_ISR_OVW) {
- ++sc->sc_arpcom.ac_if.if_ierrors;
- #ifdef DIAGNOSTIC
- log(LOG_WARNING,
- "%s: warning - receiver ring buffer overrun\n",
- sc->sc_dev.dv_xname);
- #endif
- /* Stop/reset/re-init NIC. */
- ed_reset(sc);
- } else {
- /*
- * Receiver Error. One or more of: CRC error,
- * frame alignment error FIFO overrun, or
- * missed packet.
- */
- if (isr & ED_ISR_RXE) {
- ++sc->sc_arpcom.ac_if.if_ierrors;
- #ifdef ED_DEBUG
- printf("%s: receive error %x\n",
- sc->sc_dev.dv_xname,
- NIC_GET(sc, ED_P0_RSR));
- #endif
- }
-
- /*
- * Go get the packet(s).
- * XXX - Doing this on an error is dubious
- * because there shouldn't be any data to get
- * (we've configured the interface to not
- * accept packets with errors).
- */
- ed_rint(sc);
- }
- }
-
- /*
- * If it looks like the transmitter can take more data, attempt
- * to start output on the interface. This is done after
- * handling the receiver to give the receiver priority.
- */
- if ((sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE) == 0)
- ed_start(&sc->sc_arpcom.ac_if);
-
- /*
- * Return NIC CR to standard state: page 0, remote DMA
- * complete, start (toggling the TXP bit off, even if was just
- * set in the transmit routine, is *okay* - it is 'edge'
- * triggered from low to high).
- */
- NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
-
- /*
- * If the Network Talley Counters overflow, read them to reset
- * them. It appears that old 8390's won't clear the ISR flag
- * otherwise - resulting in an infinite loop.
- */
- if (isr & ED_ISR_CNT) {
- (void) NIC_GET(sc, ED_P0_CNTR0);
- (void) NIC_GET(sc, ED_P0_CNTR1);
- (void) NIC_GET(sc, ED_P0_CNTR2);
- }
-
- isr = NIC_GET(sc, ED_P0_ISR);
- if (!isr)
- return (1);
- }
- }
-
- /*
- * Process an ioctl request. This code needs some work - it looks pretty ugly.
- */
- int
- ed_ioctl(ifp, command, data)
- register struct ifnet *ifp;
- u_long command;
- caddr_t data;
- {
- struct ed_softc *sc = edcd.cd_devs[ifp->if_unit];
- register struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
- int s, error = 0;
-
- s = splimp();
-
- switch (command) {
-
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
-
- switch (ifa->ifa_addr->sa_family) {
- #ifdef INET
- case AF_INET:
- ed_init(sc);
- arp_ifinit(&sc->sc_arpcom, ifa);
- break;
- #endif
- #ifdef NS
- /* XXX - This code is probably wrong. */
- case AF_NS:
- {
- register struct ns_addr *ina = &IA_SNS(ifa)->sns_addr;
-
- if (ns_nullhost(*ina))
- ina->x_host =
- *(union ns_host *)(sc->sc_arpcom.sc_enaddr);
- else
- bcopy(ina->x_host.c_host,
- sc->sc_arpcom.ac_enaddr,
- sizeof(sc->sc_arpcom.ac_enaddr));
- /* Set new address. */
- ed_init(sc);
- break;
- }
- #endif
- default:
- ed_init(sc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 &&
- (ifp->if_flags & IFF_RUNNING) != 0) {
- /*
- * If interface is marked down and it is running, then
- * stop it.
- */
- ed_stop(sc);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if ((ifp->if_flags & IFF_UP) != 0 &&
- (ifp->if_flags & IFF_RUNNING) == 0) {
- /*
- * If interface is marked up and it is stopped, then
- * start it.
- */
- ed_init(sc);
- } else {
- /*
- * Reset the interface to pick up changes in any other
- * flags that affect hardware registers.
- */
- ed_stop(sc);
- ed_init(sc);
- }
- break;
-
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- /* Update our multicast list. */
- error = (command == SIOCADDMULTI) ?
- ether_addmulti(ifr, &sc->sc_arpcom) :
- ether_delmulti(ifr, &sc->sc_arpcom);
-
- if (error == ENETRESET) {
- /*
- * Multicast list has changed; set the hardware filter
- * accordingly.
- */
- ed_stop(sc); /* XXX for ds_setmcaf? */
- ed_init(sc);
- error = 0;
- }
- break;
-
- default:
- error = EINVAL;
- }
-
- splx(s);
- return (error);
- }
-
- /*
- * Retreive packet from shared memory and send to the next level up via
- * ether_input(). If there is a BPF listener, give a copy to BPF, too.
- */
- void
- ed_get_packet(sc, buf, len)
- struct ed_softc *sc;
- caddr_t buf;
- u_short len;
- {
- struct ether_header *eh;
- struct mbuf *m, *ed_ring_to_mbuf();
-
- /* round length to word boundry */
- len = (len + 1) & ~1;
-
- /* Allocate a header mbuf. */
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- return;
- m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if;
- m->m_pkthdr.len = len;
- m->m_len = 0;
-
- /* The following silliness is to make NFS happy. */
- #define EROUND ((sizeof(struct ether_header) + 3) & ~3)
- #define EOFF (EROUND - sizeof(struct ether_header))
-
- /*
- * The following assumes there is room for the ether header in the
- * header mbuf.
- */
- m->m_data += EOFF;
- eh = mtod(m, struct ether_header *);
-
- word_copy(buf, mtod(m, caddr_t), sizeof(struct ether_header));
- buf += sizeof(struct ether_header);
- m->m_len += sizeof(struct ether_header);
- len -= sizeof(struct ether_header);
-
- /* Pull packet off interface. */
- if (ed_ring_to_mbuf(sc, buf, m, len) == 0) {
- m_freem(m);
- return;
- }
-
- #if NBPFILTER > 0
- /*
- * Check if there's a BPF listener on this interface. If so, hand off
- * the raw packet to bpf.
- */
- if (sc->sc_arpcom.ac_if.if_bpf) {
- bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m);
-
- /*
- * Note that the interface cannot be in promiscuous mode if
- * there are no BPF listeners. And if we are in promiscuous
- * mode, we have to check if this packet is really ours.
- */
- if ((sc->sc_arpcom.ac_if.if_flags & IFF_PROMISC) &&
- (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
- bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr,
- sizeof(eh->ether_dhost)) != 0) {
- m_freem(m);
- return;
- }
- }
- #endif
-
- /* Fix up data start offset in mbuf to point past ether header. */
- m_adj(m, sizeof(struct ether_header));
- ether_input(&sc->sc_arpcom.ac_if, eh, m);
- }
-
- /*
- * Supporting routines.
- */
-
- /*
- * Given a source and destination address, copy 'amount' of a packet from the
- * ring buffer into a linear destination buffer. Takes into account ring-wrap.
- */
- static inline caddr_t
- ed_ring_copy(sc, src, dst, amount)
- struct ed_softc *sc;
- caddr_t src, dst;
- u_short amount;
- {
- u_short tmp_amount;
-
- /* Does copy wrap to lower addr in ring buffer? */
- if (src + amount > sc->mem_end) {
- tmp_amount = sc->mem_end - src;
-
- /* Copy amount up to end of NIC memory. */
- word_copy(src, dst, tmp_amount);
-
- amount -= tmp_amount;
- src = sc->mem_ring;
- dst += tmp_amount;
- }
-
- word_copy(src, dst, amount);
-
- return (src + amount);
- }
-
- /*
- * Copy data from receive buffer to end of mbuf chain allocate additional mbufs
- * as needed. Return pointer to last mbuf in chain.
- * sc = ed info (softc)
- * src = pointer in ed ring buffer
- * dst = pointer to last mbuf in mbuf chain to copy to
- * amount = amount of data to copy
- */
- struct mbuf *
- ed_ring_to_mbuf(sc, src, dst, total_len)
- struct ed_softc *sc;
- caddr_t src;
- struct mbuf *dst;
- u_short total_len;
- {
- register struct mbuf *m = dst;
-
- /* Round the length to a word boundary. */
- /* total_len = (total_len + 1) & ~1; */
-
- while (total_len) {
- register u_short amount = min(total_len, M_TRAILINGSPACE(m));
-
- if (amount == 0) {
- /*
- * No more data in this mbuf; alloc another.
- *
- * If there is enough data for an mbuf cluster, attempt
- * to allocate one of those, otherwise, a regular mbuf
- * will do.
- * Note that a regular mbuf is always required, even if
- * we get a cluster - getting a cluster does not
- * allocate any mbufs, and one is needed to assign the
- * cluster to. The mbuf that has a cluster extension
- * can not be used to contain data - only the cluster
- * can contain data.
- */
- dst = m;
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- return (0);
-
- if (total_len >= MINCLSIZE)
- MCLGET(m, M_DONTWAIT);
-
- m->m_len = 0;
- dst->m_next = m;
- amount = min(total_len, M_TRAILINGSPACE(m));
- }
-
- src = ed_ring_copy(sc, src, mtod(m, caddr_t) + m->m_len,
- amount);
-
- m->m_len += amount;
- total_len -= amount;
- }
- return (m);
- }
-
- /*
- * Compute the multicast address filter from the list of multicast addresses we
- * need to listen to.
- */
- void
- ed_getmcaf(ac, af)
- struct arpcom *ac;
- u_long *af;
- {
- struct ifnet *ifp = &ac->ac_if;
- struct ether_multi *enm;
- register u_char *cp, c;
- register u_long crc;
- register int i, len;
- struct ether_multistep step;
-
- /*
- * Set up multicast address filter by passing all multicast addresses
- * through a crc generator, and then using the high order 6 bits as an
- * index into the 64 bit logical address filter. The high order bit
- * selects the word, while the rest of the bits select the bit within
- * the word.
- */
-
- if (ifp->if_flags & IFF_PROMISC) {
- ifp->if_flags |= IFF_ALLMULTI;
- af[0] = af[1] = 0xffffffff;
- return;
- }
-
- af[0] = af[1] = 0;
- ETHER_FIRST_MULTI(step, ac, enm);
- while (enm != NULL) {
- if (bcmp(enm->enm_addrlo, enm->enm_addrhi,
- sizeof(enm->enm_addrlo)) != 0) {
- /*
- * We must listen to a range of multicast addresses.
- * For now, just accept all multicasts, rather than
- * trying to set only those filter bits needed to match
- * the range. (At this time, the only use of address
- * ranges is for IP multicast routing, for which the
- * range is big enough to require all bits set.)
- */
- ifp->if_flags |= IFF_ALLMULTI;
- af[0] = af[1] = 0xffffffff;
- return;
- }
-
- cp = enm->enm_addrlo;
- crc = 0xffffffff;
- for (len = sizeof(enm->enm_addrlo); --len >= 0;) {
- c = *cp++;
- for (i = 8; --i >= 0;) {
- if (((crc & 0x80000000) ? 1 : 0) ^ (c & 0x01)) {
- crc <<= 1;
- crc ^= 0x04c11db6 | 1;
- } else
- crc <<= 1;
- c >>= 1;
- }
- }
- /* Just want the 6 most significant bits. */
- crc >>= 26;
-
- /* Turn on the corresponding bit in the filter. */
- af[crc >> 5] |= 1 << ((crc & 0x1f) ^ 0);
-
- ETHER_NEXT_MULTI(step, enm);
- }
- ifp->if_flags &= ~IFF_ALLMULTI;
- }
-
- /*
- * Copy packet from mbuf to the board memory
- *
- * Currently uses an extra buffer/extra memory copy,
- * unless the whole packet fits in one mbuf.
- *
- */
- u_short
- ed_put(sc, m, buf)
- struct ed_softc *sc;
- struct mbuf *m;
- caddr_t buf;
- {
- u_char *data, savebyte[2];
- int len, wantbyte;
- u_short totlen;
-
- totlen = wantbyte = 0;
-
- for (; m != 0; m = m->m_next) {
- data = mtod(m, u_char *);
- len = m->m_len;
- totlen += len;
- if (len > 0) {
- /* Finish the last word. */
- if (wantbyte) {
- savebyte[1] = *data;
- word_copy(savebyte, buf, 2);
- buf += 2;
- data++;
- len--;
- wantbyte = 0;
- }
- /* Output contiguous words. */
- if (len > 1) {
- word_copy(data, buf, len);
- buf += len & ~1;
- data += len & ~1;
- len &= 1;
- }
- /* Save last byte, if necessary. */
- if (len == 1) {
- savebyte[0] = *data;
- wantbyte = 1;
- }
- }
- }
-
- if (wantbyte) {
- savebyte[1] = 0;
- word_copy(savebyte, buf, 2);
- buf += 2;
- }
-
- return (totlen);
- }
--- 0 ----
*** old-NetBSD/src/sys/arch/amiga/dev/if_edreg.h
--- /dev/null Tue Aug 22 20:27:16 1995
***************
*** 1,43 ****
- /* $NetBSD: if_edreg.h,v 1.4 1995/05/08 02:40:54 chopps Exp $ */
-
- /*
- * Vendor types
- */
- #define ED_VENDOR_HYDRA 0x03 /* Hydra Systems */
-
- /*
- * Compile-time config flags
- */
- /*
- * This sets the default for enabling/disablng the tranceiver.
- */
- #define ED_FLAGS_DISABLE_TRANCEIVER 0x0001
-
- /*
- * This forces the board to be used in 8/16-bit mode even if it autoconfigs
- * differently.
- */
- #define ED_FLAGS_FORCE_8BIT_MODE 0x0002
- #define ED_FLAGS_FORCE_16BIT_MODE 0x0004
-
- /*
- * This disables the use of double transmit buffers.
- */
- #define ED_FLAGS_NO_MULTI_BUFFERING 0x0008
-
- /*
- * This forces all operations with the NIC memory to use Programmed I/O (i.e.
- * not via shared memory).
- */
- #define ED_FLAGS_FORCE_PIO 0x0010
-
- /*
- * Definitions for Hydra Systems boards
- */
- #define HYDRA_ADDRPROM 0xffc0
- #define HYDRA_NIC_BASE 0xffe1
- /*
- * Definitions for ASDG LANRover boards
- */
- #define ASDG_ADDRPROM 0xff
- #define ASDG_NIC_BASE 0x1
--- 0 ----
*** old-NetBSD/src/sys/arch/amiga/dev/if_le.c
--- /dev/null Tue Aug 22 20:27:16 1995
***************
*** 1,957 ****
- /* $NetBSD: if_le.c,v 1.14 1995/07/02 00:16:06 mycroft Exp $ */
-
- /*
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 7.6 (Berkeley) 5/8/91
- */
-
- #include "le.h"
- #if NLE > 0
-
- #include "bpfilter.h"
-
- /*
- * AMD 7990 LANCE
- *
- * This driver will generate and accept tailer encapsulated packets even
- * though it buys us nothing. The motivation was to avoid incompatibilities
- * with VAXen, SUNs, and others that handle and benefit from them.
- * This reasoning is dubious.
- */
- #include <sys/param.h>
- #include <sys/systm.h>
- #include <sys/mbuf.h>
- #include <sys/buf.h>
- #include <sys/protosw.h>
- #include <sys/socket.h>
- #include <sys/syslog.h>
- #include <sys/ioctl.h>
- #include <sys/errno.h>
- #include <sys/device.h>
-
- #include <net/if.h>
- #include <net/netisr.h>
- #include <net/route.h>
-
- #ifdef INET
- #include <netinet/in.h>
- #include <netinet/in_systm.h>
- #include <netinet/in_var.h>
- #include <netinet/ip.h>
- #include <netinet/if_ether.h>
- #endif
-
- #ifdef NS
- #include <netns/ns.h>
- #include <netns/ns_if.h>
- #endif
-
- #include <machine/cpu.h>
- #include <machine/mtpr.h>
- #include <amiga/amiga/device.h>
- #include <amiga/amiga/isr.h>
- #include <amiga/dev/zbusvar.h>
- #include <amiga/dev/if_lereg.h>
-
- /*
- * Ethernet software status per interface.
- *
- * Each interface is referenced by a network interface structure,
- * le_if, which the routing code uses to locate the interface.
- * This structure contains the output queue for the interface, its address, ...
- */
- struct le_softc {
- struct isr sc_isr;
- struct arpcom sc_ac; /* common Ethernet structures */
- #define sc_if sc_ac.ac_if /* network-visible interface */
- #define sc_addr sc_ac.ac_enaddr /* hardware Ethernet address */
- void *sc_base; /* base address of board */
- struct lereg1 *sc_r1; /* LANCE registers */
- struct lereg2 *sc_r2; /* dual-port RAM */
- int sc_rmd; /* predicted next rmd to process */
- int sc_tmd; /* next tmd to use */
- int sc_no_td; /* number of tmds in use */
- int sc_runt;
- int sc_jab;
- int sc_merr;
- int sc_babl;
- int sc_cerr;
- int sc_miss;
- int sc_xint;
- int sc_xown;
- int sc_uflo;
- int sc_rxlen;
- int sc_rxoff;
- int sc_txoff;
- int sc_busy;
- short sc_iflags;
- #if NBPFILTER > 0
- caddr_t sc_bpf;
- #endif
- } le_softc[NLE];
-
- #if NBPFILTER > 0
- #include <net/bpf.h>
- #include <net/bpfdesc.h>
- #endif
-
- /* offsets for: ID, REGS, MEM */
- int lestd[] = { 0, 0x4000, 0x8000 };
-
- /* console error messages */
- int ledebug = 0;
-
- int leioctl __P((struct ifnet *, u_long, caddr_t));
- int leintr __P((struct le_softc *));
- void lestart __P((struct ifnet *));
- void leinit __P((int));
-
- struct mbuf *leget();
- extern struct ifnet loif;
-
- void leattach __P((struct device *, struct device *, void *));
- int lematch __P((struct device *, struct cfdata *, void *args));
-
- struct cfdriver lecd = {
- NULL, "le", (cfmatch_t)lematch, leattach, DV_IFNET,
- sizeof(struct le_softc), NULL, 0};
-
- int
- lematch(pdp, cfp, auxp)
- struct device *pdp;
- struct cfdata *cfp;
- void *auxp;
- {
-
- struct zbus_args *zap;
-
- zap = (struct zbus_args *)auxp;
-
- /* Commodore ethernet card */
- if ( zap->manid == 514 && zap->prodid == 112)
- return(1);
-
- /* Ameristar ethernet card */
- if ( zap->manid == 1053 && zap->prodid == 1)
- return(1);
-
- return (0);
- }
-
- /*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
- void
- leattach(pdp, dp, auxp)
- struct device *pdp, *dp;
- void *auxp;
- {
- register struct lereg0 *ler0;
- register struct lereg2 *ler2;
- struct zbus_args *zap;
- struct lereg2 *lemem = (struct lereg2 *) 0x8000;
- struct le_softc *le = &le_softc[dp->dv_unit];
- struct ifnet *ifp = &le->sc_if;
- char *cp;
- int i;
- unsigned long ser;
- int s = splhigh ();
-
- zap =(struct zbus_args *)auxp;
-
- /*
- * Make config msgs look nicer.
- */
- printf("\n");
-
- ler0 = le->sc_base = zap->va;
- le->sc_r1 = (struct lereg1 *)(lestd[1] + (int)zap->va);
- ler2 = le->sc_r2 = (struct lereg2 *)(lestd[2] + (int)zap->va);
-
- /*
- * Manufacturer decides the 3 first bytes, i.e. ethernet vendor ID.
- */
- if ( zap->manid == 514 && zap->prodid == 112) {
- /* Commodore 2065 */
- le->sc_addr[0] = 0x00;
- le->sc_addr[1] = 0x80;
- le->sc_addr[2] = 0x10;
- }
- if ( zap->manid == 1053 && zap->prodid == 1) {
- le->sc_addr[0] = 0x00;
- le->sc_addr[1] = 0x00;
- le->sc_addr[2] = 0x9f;
- }
-
- /*
- * Serial number for board is used as host ID.
- */
- ser = (unsigned long) zap->serno;
-
- le->sc_addr[3] = (ser >> 16) & 0xff;
- le->sc_addr[4] = (ser >> 8) & 0xff;
- le->sc_addr[5] = (ser ) & 0xff;
-
- #ifdef LE_USE_16K
- printf("le%d: hardware address %s 16K\n",
- #else
- printf("le%d: hardware address %s 32K\n",
- #endif
- dp->dv_unit, ether_sprintf(le->sc_addr));
-
- /*
- * Setup for transmit/receive
- */
- ler2->ler2_mode = LE_MODE;
- ler2->ler2_padr[0] = le->sc_addr[1];
- ler2->ler2_padr[1] = le->sc_addr[0];
- ler2->ler2_padr[2] = le->sc_addr[3];
- ler2->ler2_padr[3] = le->sc_addr[2];
- ler2->ler2_padr[4] = le->sc_addr[5];
- ler2->ler2_padr[5] = le->sc_addr[4];
- ler2->ler2_ladrf0 = 0;
- ler2->ler2_ladrf1 = 0;
- ler2->ler2_rlen = LE_RLEN;
- ler2->ler2_rdra = (int)lemem->ler2_rmd;
- ler2->ler2_tlen = LE_TLEN;
- ler2->ler2_tdra = (int)lemem->ler2_tmd;
-
- splx (s);
-
- ifp->if_unit = dp->dv_unit;
- ifp->if_name = "le";
- ifp->if_mtu = ETHERMTU;
- ifp->if_ioctl = leioctl;
- ifp->if_output = ether_output;
- ifp->if_start = lestart;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
-
- #if NBPFILTER > 0
- bpfattach(&le->sc_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
- #endif
- if_attach(ifp);
- ether_ifattach(ifp);
-
- le->sc_isr.isr_intr = leintr;
- le->sc_isr.isr_arg = le;
- le->sc_isr.isr_ipl = 2;
- add_isr (&le->sc_isr);
-
- return;
- }
-
- ledrinit(ler2)
- register struct lereg2 *ler2;
- {
- register struct lereg2 *lemem = (struct lereg2 *) 0x8000;
- register int i;
-
- for (i = 0; i < LERBUF; i++) {
- ler2->ler2_rmd[i].rmd0 = (int)lemem->ler2_rbuf[i];
- ler2->ler2_rmd[i].rmd1 = LE_OWN;
- ler2->ler2_rmd[i].rmd2 = -LEMTU;
- ler2->ler2_rmd[i].rmd3 = 0;
- }
-
- for (i = 0; i < LETBUF; i++) {
- ler2->ler2_tmd[i].tmd0 = (int)lemem->ler2_tbuf[i];
- ler2->ler2_tmd[i].tmd1 = 0;
- ler2->ler2_tmd[i].tmd2 = 0;
- ler2->ler2_tmd[i].tmd3 = 0;
- }
- }
-
- void
- lereset(unit)
- register int unit;
- {
- register struct le_softc *le = &le_softc[unit];
- register struct lereg1 *ler1 = le->sc_r1;
- /*
- * This structure is referenced from the CARDS/LANCE point of
- * view, thus the 0x8000 address which is the buffer RAM area of
- * the Commodore and Ameristar cards. This pointer is manipulated
- * with the LANCE's view of memory and NOT the Amiga's. FYI.
- */
- register struct lereg2 *lemem = (struct lereg2 *) 0x8000;
-
- register int timo = 100000;
- register int stat;
-
- #ifdef lint
- stat = unit;
- #endif
- #if NBPFILTER > 0
- if (le->sc_if.if_flags & IFF_PROMISC)
- /* set the promiscuous bit */
- le->sc_r2->ler2_mode = LE_MODE|0x8000;
- else
- le->sc_r2->ler2_mode = LE_MODE;
- #endif
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_STOP;
-
- ledrinit(le->sc_r2);
-
- le->sc_rmd = le->sc_tmd = le->sc_no_td = 0;
- ler1->ler1_rap = LE_CSR1;
- ler1->ler1_rdp = (int)&lemem->ler2_mode;
- ler1->ler1_rap = LE_CSR2;
- ler1->ler1_rdp = 0;
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_INIT;
-
- do {
- if (--timo == 0) {
- printf("le%d: init timeout, stat = 0x%x\n",
- unit, stat);
- break;
- }
- stat = ler1->ler1_rdp;
- } while ((stat & LE_IDON) == 0);
-
- ler1->ler1_rdp = LE_STOP;
- ler1->ler1_rap = LE_CSR3;
- ler1->ler1_rdp = LE_BSWP;
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_STRT | LE_INEA;
- le->sc_if.if_flags &= ~IFF_OACTIVE;
-
- return;
- }
-
- /*
- * Initialization of interface
- */
- void
- leinit(unit)
- int unit;
- {
- struct le_softc *le = &le_softc[unit];
- register struct ifnet *ifp = &le->sc_if;
- int s;
-
- if ((ifp->if_flags & IFF_RUNNING) == 0) {
- s = splimp();
- ifp->if_flags |= IFF_RUNNING;
- lereset(unit);
- (void) lestart(ifp);
- splx(s);
- }
-
- return;
- }
-
- #define LENEXTTMP \
- if (++bix == LETBUF) bix = 0, tmd = le->sc_r2->ler2_tmd; else ++tmd
-
- /*
- * Start output on interface. Get another datagram to send
- * off of the interface queue, and copy it to the interface
- * before starting the output.
- */
- void
- lestart(ifp)
- struct ifnet *ifp;
- {
- register struct le_softc *le = &le_softc[ifp->if_unit];
- register int bix;
- register struct letmd *tmd;
- register struct mbuf *m;
- int len;
-
- if ((le->sc_if.if_flags & IFF_RUNNING) == 0)
- return;
-
- bix = le->sc_tmd;
- tmd = &le->sc_r2->ler2_tmd[bix];
-
- for (;;) {
- if (le->sc_no_td >= LETBUF) {
- le->sc_if.if_flags |= IFF_OACTIVE;
- break;
- }
-
- IF_DEQUEUE(&le->sc_if.if_snd, m);
- if (m == 0)
- break;
-
- ++le->sc_no_td;
-
- len = leput(le->sc_r2->ler2_tbuf[bix], m);
-
- #if NBPFILTER > 0
- /*
- * If bpf is listening on this interface, let it
- * see the packet before we commit it to the wire.
- */
- if (le->sc_bpf)
- bpf_tap(le->sc_bpf, le->sc_r2->ler2_tbuf[bix], len);
- #endif
-
- tmd->tmd3 = 0;
- tmd->tmd2 = -len;
- tmd->tmd1 = LE_OWN | LE_STP | LE_ENP;
-
- LENEXTTMP;
- }
-
- le->sc_tmd = bix;
- }
-
- int
- leintr(le)
- struct le_softc *le;
- {
- #if 0
- register struct le_softc *le = &le_softc[unit];
- #else
- int unit = le->sc_if.if_unit;
- #endif
- register struct lereg1 *ler1;
- register int stat;
-
- /* if not even initialized, don't do anything further.. */
- if (! le->sc_base)
- return 0;
-
- ler1 = le->sc_r1;
- stat = ler1->ler1_rdp;
-
- if (! (stat & LE_INTR))
- return 0;
-
- if (stat & LE_SERR) {
- leerror(unit, stat);
- if (stat & LE_MERR) {
- le->sc_merr++;
- lereset(unit);
- return(1);
- }
- if (stat & LE_BABL)
- le->sc_babl++;
- if (stat & LE_CERR)
- le->sc_cerr++;
- if (stat & LE_MISS)
- le->sc_miss++;
- ler1->ler1_rdp = LE_BABL|LE_CERR|LE_MISS|LE_INEA;
- }
- if ((stat & LE_RXON) == 0) {
- le->sc_rxoff++;
- lereset(unit);
- return(1);
- }
- if ((stat & LE_TXON) == 0) {
- le->sc_txoff++;
- lereset(unit);
- return(1);
- }
- if (stat & LE_RINT) {
- /* interrupt is cleared in lerint */
- lerint(unit);
- }
- if (stat & LE_TINT) {
- ler1->ler1_rdp = LE_TINT|LE_INEA;
- lexint(unit);
- }
- return(1);
- }
-
- /*
- * Ethernet interface transmitter interrupt.
- * Start another output if more data to send.
- */
- lexint(unit)
- register int unit;
- {
- register struct le_softc *le = &le_softc[unit];
- register int bix = (le->sc_tmd - le->sc_no_td + LETBUF) % LETBUF;
- register struct letmd *tmd = &le->sc_r2->ler2_tmd[bix];
-
- if ((le->sc_if.if_flags & IFF_OACTIVE) == 0) {
- le->sc_xint++;
- return;
- }
- if (tmd->tmd1 & LE_OWN) {
- printf("le%d: extra xint\n", unit);
- le->sc_xown++;
- return;
- }
- le->sc_if.if_flags &= ~IFF_OACTIVE;
-
- do {
- if (le->sc_no_td <= 0)
- break;
- --le->sc_no_td;
-
- if (tmd->tmd1 & LE_ERR) {
- err:
- printf("le%d: xint error\n", unit);
- lexerror(unit);
- le->sc_if.if_oerrors++;
- if (tmd->tmd3 & (LE_TBUFF|LE_UFLO)) {
- le->sc_uflo++;
- lereset(unit);
- return;
- }
- else if (tmd->tmd3 & LE_LCOL)
- le->sc_if.if_collisions++;
- else if (tmd->tmd3 & LE_RTRY)
- le->sc_if.if_collisions += 16;
- }
- else if (tmd->tmd3 & LE_TBUFF)
- /* XXX documentation says BUFF not included in ERR */
- goto err;
- else if (tmd->tmd1 & LE_ONE)
- le->sc_if.if_collisions++;
- else if (tmd->tmd1 & LE_MORE)
- /* what is the real number? */
- le->sc_if.if_collisions += 2;
- else
- le->sc_if.if_opackets++;
- LENEXTTMP;
- } while ((tmd->tmd1 & LE_OWN) == 0);
-
- (void) lestart(&le->sc_if);
- }
-
- #define LENEXTRMP \
- if (++bix == LERBUF) bix = 0, rmd = le->sc_r2->ler2_rmd; else ++rmd
-
- /*
- * Ethernet interface receiver interrupt.
- * If input error just drop packet.
- * Decapsulate packet based on type and pass to type specific
- * higher-level input routine.
- */
- lerint(unit)
- int unit;
- {
- register struct le_softc *le = &le_softc[unit];
- register int bix = le->sc_rmd;
- register struct lermd *rmd = &le->sc_r2->ler2_rmd[bix];
-
- /*
- * Out of sync with hardware, should never happen?
- */
- if (rmd->rmd1 & LE_OWN) {
- le->sc_r1->ler1_rdp = LE_RINT|LE_INEA;
- return;
- }
-
- /*
- * Process all buffers with valid data
- */
- while ((rmd->rmd1 & LE_OWN) == 0) {
- int len = rmd->rmd3;
-
- /* Clear interrupt to avoid race condition */
- le->sc_r1->ler1_rdp = LE_RINT|LE_INEA;
-
- if (rmd->rmd1 & LE_ERR) {
- le->sc_rmd = bix;
- lererror(unit, "bad packet");
- le->sc_if.if_ierrors++;
- } else if ((rmd->rmd1 & (LE_STP|LE_ENP)) != (LE_STP|LE_ENP)) {
- /*
- * Find the end of the packet so we can see how long
- * it was. We still throw it away.
- */
- do {
- le->sc_r1->ler1_rdp = LE_RINT|LE_INEA;
- rmd->rmd3 = 0;
- rmd->rmd1 = LE_OWN;
- LENEXTRMP;
- } while (!(rmd->rmd1 & (LE_OWN|LE_ERR|LE_STP|LE_ENP)));
-
- le->sc_rmd = bix;
- lererror(unit, "chained buffer");
- le->sc_rxlen++;
-
- /*
- * If search terminated without successful completion
- * we reset the hardware (conservative).
- */
- if ((rmd->rmd1 & (LE_OWN|LE_ERR|LE_STP|LE_ENP)) != LE_ENP) {
- lereset(unit);
- return;
- }
- } else
- leread(unit, le->sc_r2->ler2_rbuf[bix], len);
-
- rmd->rmd3 = 0;
- rmd->rmd1 = LE_OWN;
- LENEXTRMP;
-
- }
-
- le->sc_rmd = bix;
- }
-
- leread(unit, buf, len)
- int unit;
- char *buf;
- int len;
- {
- register struct le_softc *le = &le_softc[unit];
- register struct ether_header *et;
- struct mbuf *m;
- int off, resid;
-
- le->sc_if.if_ipackets++;
-
- et = (struct ether_header *)buf;
- et->ether_type = ntohs((u_short)et->ether_type);
-
- /* adjust input length to account for header and CRC */
- len = len - sizeof(struct ether_header) - 4;
-
- #define ledataaddr(et, off, type) ((type)(((caddr_t)((et)+1)+(off))))
- if (et->ether_type >= ETHERTYPE_TRAIL &&
- et->ether_type < ETHERTYPE_TRAIL+ETHERTYPE_NTRAILER) {
- off = (et->ether_type - ETHERTYPE_TRAIL) * 512;
- if (off >= ETHERMTU)
- return; /* sanity */
- et->ether_type = ntohs(*ledataaddr(et, off, u_short *));
- resid = ntohs(*(ledataaddr(et, off+2, u_short *)));
- if (off + resid > len)
- return; /* sanity */
- len = off + resid;
- } else
- off = 0;
-
- if (len <= 0) {
- if (ledebug)
- log(LOG_WARNING,
- "le%d: ierror(runt packet): from %s: len=%d\n",
- unit, ether_sprintf(et->ether_shost), len);
- le->sc_runt++;
- le->sc_if.if_ierrors++;
- return;
- }
- #if NBPFILTER > 0
- /*
- * Check if there's a bpf filter listening on this interface.
- * If so, hand off the raw packet to bpf, which must deal with
- * trailers in its own way.
- */
- if (le->sc_bpf) {
- bpf_tap(le->sc_bpf, buf, len + sizeof(struct ether_header));
-
- /*
- * Note that the interface cannot be in promiscuous mode if
- * there are no bpf listeners. And if we are in promiscuous
- * mode, we have to check if this packet is really ours.
- *
- * XXX This test does not support multicasts.
- */
- if ((le->sc_if.if_flags & IFF_PROMISC)
- && bcmp(et->ether_dhost, le->sc_addr,
- sizeof(et->ether_dhost)) != 0
- && bcmp(et->ether_dhost, etherbroadcastaddr,
- sizeof(et->ether_dhost)) != 0)
- return;
- }
- #endif
- /*
- * Pull packet off interface. Off is nonzero if packet
- * has trailing header; leget will then force this header
- * information to be at the front, but we still have to drop
- * the type and length which are at the front of any trailer data.
- */
- m = leget(buf, len, off, &le->sc_if);
- if (m == 0)
- return;
-
- ether_input(&le->sc_if, et, m);
- }
-
- /*
- * Routine to copy from mbuf chain to transmit
- * buffer in board local memory.
- */
- leput(lebuf, m)
- register char *lebuf;
- register struct mbuf *m;
- {
- register struct mbuf *mp;
- register int len, tlen = 0;
-
- for (mp = m; mp; mp = mp->m_next) {
- len = mp->m_len;
- if (len == 0)
- continue;
- tlen += len;
- bcopy(mtod(mp, char *), lebuf, len);
- lebuf += len;
- }
-
- m_freem(m);
-
- if (tlen < LEMINSIZE) {
- bzero(lebuf, LEMINSIZE - tlen);
- tlen = LEMINSIZE;
- }
-
- return(tlen);
- }
-
- /*
- * Routine to copy from board local memory into mbufs.
- */
- struct mbuf *
- leget(lebuf, totlen, off0, ifp)
- char *lebuf;
- int totlen, off0;
- struct ifnet *ifp;
- {
- register struct mbuf *m;
- struct mbuf *top = 0, **mp = ⊤
- register int off = off0, len;
- register char *cp;
- char *epkt;
-
- lebuf += sizeof (struct ether_header);
- cp = lebuf;
- epkt = cp + totlen;
- if (off) {
- cp += off + 2 * sizeof(u_short);
- totlen -= 2 * sizeof(u_short);
- }
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
-
- if (m == 0)
- return (0);
-
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = totlen;
- m->m_len = MHLEN;
-
- while (totlen > 0) {
-
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- return (0);
- }
- m->m_len = MLEN;
- }
-
- len = min(totlen, epkt - cp);
- if (len >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- m->m_len = len = min(len, MCLBYTES);
- else
- len = m->m_len;
- } else {
- /*
- * Place initial small packet/header at end of mbuf.
- */
- if (len < m->m_len) {
- if (top == 0 && len + max_linkhdr <= m->m_len)
- m->m_data += max_linkhdr;
- m->m_len = len;
- } else
- len = m->m_len;
- }
-
- bcopy(cp, mtod(m, caddr_t), (unsigned)len);
- cp += len;
- *mp = m;
- mp = &m->m_next;
- totlen -= len;
-
- if (cp == epkt)
- cp = lebuf;
-
- }
-
- return (top);
- }
-
- /*
- * Process an ioctl request.
- */
- int
- leioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
- {
- register struct ifaddr *ifa = (struct ifaddr *)data;
- struct le_softc *le = &le_softc[ifp->if_unit];
- struct lereg1 *ler1 = le->sc_r1;
- int s = splimp(), error = 0;
-
- switch (cmd) {
-
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- switch (ifa->ifa_addr->sa_family) {
- #ifdef INET
- case AF_INET:
- leinit(ifp->if_unit);
- arp_ifinit(&le->sc_ac, ifa);
- break;
- #endif
- #ifdef NS
- case AF_NS:
- {
- register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
-
- if (ns_nullhost(*ina))
- ina->x_host = *(union ns_host *)(le->sc_addr);
- else {
- /*
- * The manual says we can't change the address
- * while the receiver is armed,
- * so reset everything
- */
- ifp->if_flags &= ~IFF_RUNNING;
- bcopy((caddr_t)ina->x_host.c_host,
- (caddr_t)le->sc_addr, sizeof(le->sc_addr));
- }
- leinit(ifp->if_unit); /* does le_setaddr() */
- break;
- }
- #endif
- default:
- leinit(ifp->if_unit);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 &&
- ifp->if_flags & IFF_RUNNING) {
- ler1->ler1_rdp = LE_STOP;
- ifp->if_flags &= ~IFF_RUNNING;
- } else if (ifp->if_flags & IFF_UP && (ifp->if_flags & IFF_RUNNING) == 0)
- leinit(ifp->if_unit);
-
- /*
- * If the state of the promiscuous bit changes, the interface
- * must be reset to effect the change.
- */
- if (((ifp->if_flags ^ le->sc_iflags) & IFF_PROMISC) && (ifp->if_flags & IFF_RUNNING)) {
- le->sc_iflags = ifp->if_flags;
- lereset(ifp->if_unit);
- lestart(ifp);
- }
- break;
-
- default:
- error = EINVAL;
- }
-
- splx(s);
- return (error);
- }
-
- leerror(unit, stat)
- int unit;
- int stat;
- {
- if (!ledebug)
- return;
-
- /*
- * Not all transceivers implement heartbeat
- * so we only log CERR once.
- */
- if ((stat & LE_CERR) && le_softc[unit].sc_cerr)
- return;
-
- log(LOG_WARNING,
- "le%d: error: stat=%b\n", unit,
- stat,
- "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT");
- }
-
- lererror(unit, msg)
- int unit;
- char *msg;
- {
- register struct le_softc *le = &le_softc[unit];
- register struct lermd *rmd;
- int len;
-
- if (!ledebug)
- return;
-
- rmd = &le->sc_r2->ler2_rmd[le->sc_rmd];
- len = rmd->rmd3;
-
- log(LOG_WARNING,
- "le%d: ierror(%s): from %s: buf=%d, len=%d, rmd1=%b\n",
- unit, msg,
- len > 11 ? ether_sprintf(&le->sc_r2->ler2_rbuf[le->sc_rmd][6]) : "unknown",
- le->sc_rmd, len,
- rmd->rmd1,
- "\20\20OWN\17ERR\16FRAM\15OFLO\14CRC\13RBUF\12STP\11ENP");
- }
-
- lexerror(unit)
- int unit;
- {
- register struct le_softc *le = &le_softc[unit];
- int bix;
- register struct letmd *tmd;
- int len;
-
- if (!ledebug)
- return;
-
- bix = (le->sc_tmd - le->sc_no_td + LETBUF) % LETBUF;
- tmd = &le->sc_r2->ler2_tmd[bix];
- len = -tmd->tmd2;
-
- log(LOG_WARNING,
- "le%d: oerror: to %s: buf=%d, len=%d, tmd1=%b, tmd3=%b\n",
- unit,
- len > 5 ? ether_sprintf(&le->sc_r2->ler2_tbuf[0][0]) : "unknown",
- 0, len,
- tmd->tmd1,
- "\20\20OWN\17ERR\16RES\15MORE\14ONE\13DEF\12STP\11ENP",
- tmd->tmd3,
- "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY");
- }
-
- #endif
-
-
--- 0 ----
*** old-NetBSD/src/sys/arch/amiga/dev/if_lereg.h
--- /dev/null Tue Aug 22 20:27:16 1995
***************
*** 1,175 ****
- /* $NetBSD: if_lereg.h,v 1.5 1994/12/28 09:25:30 chopps Exp $ */
-
- /*
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 7.1 (Berkeley) 5/8/90
- */
-
- #define LEID 21
-
- #define LEMTU 1518
- #define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
-
- /* HP seems to have 16K RAM on board, A2065/Ameristar come with 32K.
- First try to get a working driver with the HP values, and later
- try and see whether 32K works too. */
- #define LE_USE_32K
-
- #ifdef LE_USE_16K
- #define LERBUF 8
- #define LERBUFLOG2 3
- #define LETBUF 4
- #define LETBUFLOG2 2
- #else /* 32K */
- #define LERBUF 16
- #define LERBUFLOG2 4
- #define LETBUF 4
- #define LETBUFLOG2 2
- #endif
-
- #define LE_RLEN (LERBUFLOG2 << 13)
- #define LE_TLEN (LETBUFLOG2 << 13)
-
- #define vu_char volatile u_char
-
- /*
- * LANCE registers.
- */
- #if 0
- /* doesn't exist on amiga, there's autoconfig registers in this area */
- struct lereg0 {
- u_char ler0_pad0;
- vu_char ler0_id; /* ID */
- u_char ler0_pad1;
- vu_char ler0_status; /* interrupt enable/status */
- };
- #endif
-
- struct lereg1 {
- u_short ler1_rdp; /* data port */
- u_short ler1_rap; /* register select port */
- };
-
- /*
- * Overlayed on 16K dual-port RAM.
- * Current size is 13,758 bytes with 8 x 1518 receive buffers and
- * 1 x 1518 transmit buffer.
- */
- struct lereg2 {
- /* init block */
- u_short ler2_mode; /* +0x0000 */
- u_char ler2_padr[6]; /* +0x0002 */
- u_long ler2_ladrf0; /* +0x0008 */
- u_long ler2_ladrf1; /* +0x000C */
- u_short ler2_rdra; /* +0x0010 */
- u_short ler2_rlen; /* +0x0012 */
- u_short ler2_tdra; /* +0x0014 */
- u_short ler2_tlen; /* +0x0016 */
- /* receive message descriptors */
- struct lermd { /* +0x0018 */
- u_short rmd0;
- u_short rmd1;
- short rmd2;
- u_short rmd3;
- } ler2_rmd[LERBUF];
- /* transmit message descriptors */
- struct letmd { /* +0x0058 */
- u_short tmd0;
- u_short tmd1;
- short tmd2;
- u_short tmd3;
- } ler2_tmd[LETBUF];
- char ler2_rbuf[LERBUF][LEMTU]; /* +0x0060 */
- char ler2_tbuf[LETBUF][LEMTU]; /* +0x2FD0 */
- };
-
- #if 0
- /*
- * Control and status bits -- lereg0
- */
- #define LE_IE 0x80 /* interrupt enable */
- #define LE_IR 0x40 /* interrupt requested */
- #define LE_LOCK 0x08 /* lock status register */
- #define LE_ACK 0x04 /* ack of lock */
- #define LE_JAB 0x02 /* loss of tx clock (???) */
- #define LE_IPL(x) ((((x) >> 4) & 0x3) + 3)
- #endif
-
- /*
- * Control and status bits -- lereg1
- */
- #define LE_CSR0 0
- #define LE_CSR1 1
- #define LE_CSR2 2
- #define LE_CSR3 3
-
- #define LE_SERR 0x8000
- #define LE_BABL 0x4000
- #define LE_CERR 0x2000
- #define LE_MISS 0x1000
- #define LE_MERR 0x0800
- #define LE_RINT 0x0400
- #define LE_TINT 0x0200
- #define LE_IDON 0x0100
- #define LE_INTR 0x0080
- #define LE_INEA 0x0040
- #define LE_RXON 0x0020
- #define LE_TXON 0x0010
- #define LE_TDMD 0x0008
- #define LE_STOP 0x0004
- #define LE_STRT 0x0002
- #define LE_INIT 0x0001
-
- #define LE_BSWP 0x4
- #define LE_MODE 0x0
-
- /*
- * Control and status bits -- lereg2
- */
- #define LE_OWN 0x8000
- #define LE_ERR 0x4000
- #define LE_STP 0x0200
- #define LE_ENP 0x0100
-
- #define LE_FRAM 0x2000
- #define LE_OFLO 0x1000
- #define LE_CRC 0x0800
- #define LE_RBUFF 0x0400
- #define LE_MORE 0x1000
- #define LE_ONE 0x0800
- #define LE_DEF 0x0400
- #define LE_TBUFF 0x8000
- #define LE_UFLO 0x4000
- #define LE_LCOL 0x1000
- #define LE_LCAR 0x0800
- #define LE_RTRY 0x0400
--- 0 ----
*** /dev/null
--- NetBSD/src/sys/arch/amiga/dev/if_zed.c
***************
*** 0 ****
--- 1,1238 ----
+ /* $NetBSD: if_zed.c,v 1.15 1995/08/20 02:52:48 chopps Exp $ */
+
+ /*
+ * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
+ * adapters.
+ *
+ * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
+ *
+ * Copyright (C) 1993, David Greenman. This software may be used, modified,
+ * copied, distributed, and sold, in both source and binary form provided that
+ * the above copyright and these terms are retained. Under no circumstances is
+ * the author responsible for the proper functioning of this software, nor does
+ * the author assume any responsibility for damages incurred with its use.
+ *
+ * Currently supports the Hydra Systems ethernet card.
+ */
+
+ #include "bpfilter.h"
+
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/errno.h>
+ #include <sys/ioctl.h>
+ #include <sys/mbuf.h>
+ #include <sys/socket.h>
+ #include <sys/syslog.h>
+ #include <sys/device.h>
+
+ #include <net/if.h>
+ #include <net/if_dl.h>
+ #include <net/if_types.h>
+ #include <net/netisr.h>
+
+ #ifdef INET
+ #include <netinet/in.h>
+ #include <netinet/in_systm.h>
+ #include <netinet/in_var.h>
+ #include <netinet/ip.h>
+ #include <netinet/if_ether.h>
+ #endif
+
+ #ifdef NS
+ #include <netns/ns.h>
+ #include <netns/ns_if.h>
+ #endif
+
+ #if NBPFILTER > 0
+ #include <net/bpf.h>
+ #include <net/bpfdesc.h>
+ #endif
+
+ #include <machine/cpu.h>
+ #include <machine/mtpr.h>
+
+ #include <amiga/amiga/device.h>
+ #include <amiga/amiga/isr.h>
+ #include <amiga/dev/zbusvar.h>
+ #include <dev/ic/dp8390reg.h>
+ #include <amiga/dev/if_zedreg.h>
+
+ #define HYDRA_MANID 2121
+ #define HYDRA_PRODID 1
+
+ #define ASDG_MANID 1023
+ #define ASDG_PRODID 254
+
+ /*
+ * zed_softc: per line info and status
+ */
+ struct zed_softc {
+ struct device sc_dev;
+ struct isr sc_isr;
+
+ struct arpcom sc_arpcom; /* ethernet common */
+
+ u_char volatile *nic_addr; /* NIC (DS8390) I/O address */
+
+ u_char cr_proto; /* values always set in CR */
+
+ caddr_t mem_start; /* NIC memory start address */
+ caddr_t mem_end; /* NIC memory end address */
+ u_long mem_size; /* total NIC memory size */
+ caddr_t mem_ring; /* start of RX ring-buffer (in NIC mem) */
+
+ u_char xmit_busy; /* transmitter is busy */
+ u_char txb_cnt; /* number of transmit buffers */
+ u_char txb_inuse; /* number of TX buffers currently in-use*/
+
+ u_char txb_new; /* pointer to where new buffer will be added */
+ u_char txb_next_tx; /* pointer to next buffer ready to xmit */
+ u_short txb_len[8]; /* buffered xmit buffer lengths */
+ u_char tx_page_start; /* first page of TX buffer area */
+ u_char rec_page_start; /* first page of RX ring-buffer */
+ u_char rec_page_stop; /* last page of RX ring-buffer */
+ u_char next_packet; /* pointer to next unread RX packet */
+ };
+
+ int zedmatch __P((struct device *, void *, void *));
+ void zedattach __P((struct device *, struct device *, void *));
+ int zedintr __P((struct zed_softc *));
+ int zed_ioctl __P((struct ifnet *, u_long, caddr_t));
+ void zed_start __P((struct ifnet *));
+ void zed_watchdog __P((/* short */));
+ void zed_reset __P((struct zed_softc *));
+ void zed_init __P((struct zed_softc *));
+ void zed_stop __P((struct zed_softc *));
+ void zed_getmcaf __P((struct arpcom *, u_long *));
+ u_short zed_put __P((struct zed_softc *, struct mbuf *, caddr_t));
+
+ #define inline /* XXX for debugging porpoises */
+
+ void zed_get_packet __P((/* struct zed_softc *, caddr_t, u_short */));
+ static inline void zed_rint __P((struct zed_softc *));
+ static inline void zed_xmit __P((struct zed_softc *));
+ static inline caddr_t zed_ring_copy __P((/* struct zed_softc *, caddr_t, caddr_t,
+ u_short */));
+
+ struct cfdriver zedcd = {
+ NULL, "zed", zedmatch, zedattach, DV_IFNET, sizeof(struct zed_softc)
+ };
+
+ #define ETHER_MIN_LEN 64
+ #define ETHER_MAX_LEN 1518
+ #define ETHER_ADDR_LEN 6
+
+ static inline void
+ NIC_PUT(sc, off, val)
+ struct zed_softc *sc;
+ int off;
+ u_char val;
+ {
+ sc->nic_addr[off * 2] = val;
+ #ifdef not_def
+ /*
+ * This was being used to *slow* access to the bus. I don't
+ * believe it is needed but I'll leave it around incase probelms
+ * pop-up
+ */
+ (void)ciaa.pra;
+ #endif
+ }
+
+ static inline u_char
+ NIC_GET(sc, off)
+ struct zed_softc *sc;
+ int off;
+ {
+ register u_char val;
+
+ val = sc->nic_addr[off * 2];
+ #ifdef not_def
+ /*
+ * This was being used to *slow* access to the bus. I don't
+ * believe it is needed but I'll leave it around incase probelms
+ * pop-up
+ */
+ (void)ciaa.pra;
+ #endif
+ return (val);
+ }
+
+ /*
+ * Memory copy, copies word at time.
+ */
+ static inline void
+ word_copy(a, b, len)
+ caddr_t a, b;
+ int len;
+ {
+ u_short *x = (u_short *)a,
+ *y = (u_short *)b;
+
+ len >>= 1;
+ while (len--)
+ *y++ = *x++;
+ }
+
+ int
+ zedmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+ {
+ struct zbus_args *zap = aux;
+
+ if (zap->manid == HYDRA_MANID && zap->prodid == HYDRA_PRODID)
+ return (1);
+ else if (zap->manid == ASDG_MANID && zap->prodid == ASDG_PRODID)
+ return (1);
+ return (0);
+ }
+
+ void
+ zedattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+ {
+ struct zed_softc *sc = (void *)self;
+ struct zbus_args *zap = aux;
+ struct cfdata *cf = sc->sc_dev.dv_cfdata;
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ u_char *prom;
+ int i;
+
+ if (zap->manid == HYDRA_MANID) {
+ sc->mem_start = zap->va;
+ sc->nic_addr = sc->mem_start + HYDRA_NIC_BASE;
+ prom = (u_char *)sc->mem_start + HYDRA_ADDRPROM;
+ } else {
+ sc->mem_start = zap->va + 0x8000;
+ sc->nic_addr = zap->va + ASDG_NIC_BASE;
+ prom = (u_char *)sc->nic_addr + ASDG_ADDRPROM;
+ }
+ sc->cr_proto = ED_CR_RD2;
+ sc->tx_page_start = 0;
+
+ #define memsize 16384
+
+ sc->mem_size = memsize;
+ sc->mem_end = sc->mem_start + memsize;
+
+ /*
+ * Use one xmit buffer if < 16k, two buffers otherwise (if not told
+ * otherwise).
+ */
+ if ((memsize < 16384) || (cf->cf_flags & ED_FLAGS_NO_MULTI_BUFFERING))
+ sc->txb_cnt = 1;
+ else
+ sc->txb_cnt = 2;
+
+ sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
+ sc->rec_page_stop = sc->tx_page_start + (memsize >> ED_PAGE_SHIFT);
+
+ sc->mem_ring =
+ sc->mem_start + ((sc->txb_cnt * ED_TXBUF_SIZE) << ZED_PAGE_SHIFT);
+
+ #undef memsize
+
+ /*
+ * read the ethernet address from the board
+ */
+ for (i = 0; i < ETHER_ADDR_LEN; i++)
+ sc->sc_arpcom.ac_enaddr[i] = *(prom + 2 * i);
+
+ /* Set interface to stopped condition (reset). */
+ zed_stop(sc);
+
+ /* Initialize ifnet structure. */
+ ifp->if_unit = sc->sc_dev.dv_unit;
+ ifp->if_name = zedcd.cd_name;
+ ifp->if_start = zed_start;
+ ifp->if_ioctl = zed_ioctl;
+ ifp->if_watchdog = zed_watchdog;
+ ifp->if_flags =
+ IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
+
+ /* Attach the interface. */
+ if_attach(ifp);
+ ether_ifattach(ifp);
+
+ /* Print additional info when attached. */
+ printf(": address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr));
+
+ #if NBPFILTER > 0
+ bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
+ #endif
+
+ sc->sc_isr.isr_intr = zedintr;
+ sc->sc_isr.isr_arg = sc;
+ sc->sc_isr.isr_ipl = 2;
+ add_isr(&sc->sc_isr);
+ }
+
+ /*
+ * Reset interface.
+ */
+ void
+ zed_reset(sc)
+ struct zed_softc *sc;
+ {
+ int s;
+
+ s = splimp();
+ zed_stop(sc);
+ zed_init(sc);
+ splx(s);
+ log(LOG_ERR, "%s: reset\n", sc->sc_dev.dv_xname);
+ }
+
+ /*
+ * Take interface offline.
+ */
+ void
+ zed_stop(sc)
+ struct zed_softc *sc;
+ {
+ int n = 5000;
+
+ /* Stop everything on the interface, and select page 0 registers. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_STP);
+
+ /*
+ * Wait for interface to enter stopped state, but limit # of checks to
+ * 'n' (about 5ms). It shouldn't even take 5us on modern DS8390's, but
+ * just in case it's an old one.
+ */
+ while (((NIC_GET(sc, ED_P0_ISR) & ZED_ISR_RST) == 0) && --n);
+ }
+
+ /*
+ * Device timeout/watchdog routine. Entered if the device neglects to generate
+ * an interrupt after a transmit has been started on it.
+ */
+ void
+ zed_watchdog(unit)
+ short unit;
+ {
+ struct zed_softc *sc = zedcd.cd_devs[unit];
+
+ log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
+ ++sc->sc_arpcom.ac_if.if_oerrors;
+
+ zed_reset(sc);
+ }
+
+ /*
+ * Initialize device.
+ */
+ void
+ zed_init(sc)
+ struct zed_softc *sc;
+ {
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ int i, s;
+ u_char command;
+ u_long mcaf[2];
+
+ /*
+ * Initialize the NIC in the exact order outlined in the NS manual.
+ * This init procedure is "mandatory"...don't change what or when
+ * things happen.
+ */
+ s = splimp();
+
+ /* Reset transmitter flags. */
+ sc->xmit_busy = 0;
+ sc->sc_arpcom.ac_if.if_timer = 0;
+
+ sc->txb_inuse = 0;
+ sc->txb_new = 0;
+ sc->txb_next_tx = 0;
+
+ /* Set interface for page 0, remote DMA complete, stopped. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_STP);
+
+ /*
+ * Set FIFO threshold to 8, No auto-init Remote DMA, byte
+ * order=68k, word-wide DMA xfers,
+ * XXX changed to use 2 word threshhold
+ */
+ NIC_PUT(sc, ED_P0_DCR,
+ ED_DCR_FT0 | ZED_DCR_WTS | ZED_DCR_LS | ZED_DCR_BOS);
+
+ /* Clear remote byte count registers. */
+ NIC_PUT(sc, ED_P0_RBCR0, 0);
+ NIC_PUT(sc, ED_P0_RBCR1, 0);
+
+ /* Tell RCR to do nothing for now. */
+ NIC_PUT(sc, ED_P0_RCR, ZED_RCR_MON);
+
+ /* Place NIC in internal loopback mode. */
+ NIC_PUT(sc, ED_P0_TCR, ZED_TCR_LB0);
+
+ /* Initialize receive buffer ring. */
+ NIC_PUT(sc, ED_P0_BNRY, sc->rec_page_start);
+ NIC_PUT(sc, ED_P0_PSTART, sc->rec_page_start);
+ NIC_PUT(sc, ED_P0_PSTOP, sc->rec_page_stop);
+
+ /*
+ * Clear all interrupts. A '1' in each bit position clears the
+ * corresponding flag.
+ */
+ NIC_PUT(sc, ED_P0_ISR, 0xff);
+
+ /*
+ * Enable the following interrupts: receive/transmit complete,
+ * receive/transmit error, and Receiver OverWrite.
+ *
+ * Counter overflow and Remote DMA complete are *not* enabled.
+ */
+ NIC_PUT(sc, ED_P0_IMR,
+ ED_IMR_PRXE | ZED_IMR_PTXE | ZED_IMR_RXEE | ZED_IMR_TXEE |
+ ED_IMR_OVWE);
+
+ /* Program command register for page 1. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_1 | ZED_CR_STP);
+
+ /* Copy out our station address. */
+ for (i = 0; i < ETHER_ADDR_LEN; ++i)
+ NIC_PUT(sc, ED_P1_PAR0 + i, sc->sc_arpcom.ac_enaddr[i]);
+
+ /* Set multicast filter on chip. */
+ zed_getmcaf(&sc->sc_arpcom, mcaf);
+ for (i = 0; i < 8; i++)
+ NIC_PUT(sc, ED_P1_MAR0 + i, ((u_char *)mcaf)[i]);
+
+ /*
+ * Set current page pointer to one page after the boundary pointer, as
+ * recommended in the National manual.
+ */
+ sc->next_packet = sc->rec_page_start + 1;
+ NIC_PUT(sc, ED_P1_CURR, sc->next_packet);
+
+ /* Program command register for page 0. */
+ NIC_PUT(sc, ED_P1_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_STP);
+
+ i = ED_RCR_AB | ZED_RCR_AM;
+ if (ifp->if_flags & IFF_PROMISC) {
+ /*
+ * Set promiscuous mode. Multicast filter was set earlier so
+ * that we should receive all multicast packets.
+ */
+ i |= ED_RCR_PRO | ZED_RCR_AR | ZED_RCR_SEP;
+ }
+ NIC_PUT(sc, ED_P0_RCR, i);
+
+ /* Take interface out of loopback. */
+ NIC_PUT(sc, ED_P0_TCR, 0);
+
+ /* Fire up the interface. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_STA);
+
+ /* Set 'running' flag, and clear output active flag. */
+ ifp->if_flags |= IFF_RUNNING;
+ ifp->if_flags &= ~IFF_OACTIVE;
+
+ /* ...and attempt to start output. */
+ zed_start(ifp);
+
+ splx(s);
+ }
+
+ /*
+ * This routine actually starts the transmission on the interface.
+ */
+ static inline void
+ zed_xmit(sc)
+ struct zed_softc *sc;
+ {
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ u_short len;
+
+ len = sc->txb_len[sc->txb_next_tx];
+
+ /* Set NIC for page 0 register access. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_STA);
+
+ /* Set TX buffer start page. */
+ NIC_PUT(sc, ED_P0_TPSR, sc->tx_page_start +
+ sc->txb_next_tx * ED_TXBUF_SIZE);
+
+ /* Set TX length. */
+ NIC_PUT(sc, ED_P0_TBCR0, len);
+ NIC_PUT(sc, ED_P0_TBCR1, len >> 8);
+
+ /* Set page 0, remote DMA complete, transmit packet, and *start*. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_TXP | ZED_CR_STA);
+ sc->xmit_busy = 1;
+
+ /* Point to next transmit buffer slot and wrap if necessary. */
+ sc->txb_next_tx++;
+ if (sc->txb_next_tx == sc->txb_cnt)
+ sc->txb_next_tx = 0;
+
+ /* Set a timer just in case we never hear from the board again. */
+ ifp->if_timer = 2;
+ }
+
+ /*
+ * Start output on interface.
+ * We make two assumptions here:
+ * 1) that the current priority is set to splimp _before_ this code
+ * is called *and* is returned to the appropriate priority after
+ * return
+ * 2) that the IFF_OACTIVE flag is checked before this code is called
+ * (i.e. that the output part of the interface is idle)
+ */
+ void
+ zed_start(ifp)
+ struct ifnet *ifp;
+ {
+ struct zed_softc *sc = zedcd.cd_devs[ifp->if_unit];
+ struct mbuf *m0, *m;
+ caddr_t buffer;
+ int len;
+
+ outloop:
+ /*
+ * First, see if there are buffered packets and an idle transmitter -
+ * should never happen at this point.
+ */
+ if (sc->txb_inuse && (sc->xmit_busy == 0)) {
+ printf("%s: packets buffered, but transmitter idle\n",
+ sc->sc_dev.dv_xname);
+ zed_xmit(sc);
+ }
+
+ /* See if there is room to put another packet in the buffer. */
+ if (sc->txb_inuse == sc->txb_cnt) {
+ /* No room. Indicate this to the outside world and exit. */
+ ifp->if_flags |= IFF_OACTIVE;
+ return;
+ }
+
+ IF_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m);
+ if (m == 0) {
+ /*
+ * We are using the !OACTIVE flag to indicate to the outside
+ * world that we can accept an additional packet rather than
+ * that the transmitter is _actually_ active. Indeed, the
+ * transmitter may be active, but if we haven't filled all the
+ * buffers with data then we still want to accept more.
+ */
+ ifp->if_flags &= ~IFF_OACTIVE;
+ return;
+ }
+
+ /* Copy the mbuf chain into the transmit buffer. */
+ m0 = m;
+
+ /* txb_new points to next open buffer slot. */
+ buffer = sc->mem_start + ((sc->txb_new * ED_TXBUF_SIZE) << ZED_PAGE_SHIFT);
+
+ len = zed_put(sc, m, buffer);
+
+ sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN);
+ sc->txb_inuse++;
+
+ /* Point to next buffer slot and wrap if necessary. */
+ if (++sc->txb_new == sc->txb_cnt)
+ sc->txb_new = 0;
+
+ if (sc->xmit_busy == 0)
+ zed_xmit(sc);
+
+ #if NBPFILTER > 0
+ /* Tap off here if there is a BPF listener. */
+ if (sc->sc_arpcom.ac_if.if_bpf)
+ bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m0);
+ #endif
+
+ m_freem(m0);
+
+ /* Loop back to the top to possibly buffer more packets. */
+ goto outloop;
+ }
+
+ /*
+ * Ethernet interface receiver interrupt.
+ */
+ static inline void
+ zed_rint(sc)
+ struct zed_softc *sc;
+ {
+ u_char boundary, current;
+ u_short len;
+ u_char nlen;
+ struct zed_ring packet_hdr;
+ caddr_t packet_ptr;
+
+ loop:
+ /* Set NIC to page 1 registers to get 'current' pointer. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_1 | ZED_CR_STA);
+
+ /*
+ * 'sc->next_packet' is the logical beginning of the ring-buffer - i.e.
+ * it points to where new data has been buffered. The 'CURR' (current)
+ * register points to the logical end of the ring-buffer - i.e. it
+ * points to where additional new data will be added. We loop here
+ * until the logical beginning equals the logical end (or in other
+ * words, until the ring-buffer is empty).
+ */
+ current = NIC_GET(sc, ED_P1_CURR);
+ if (sc->next_packet == current)
+ return;
+
+ /* Set NIC to page 0 registers to update boundary register. */
+ NIC_PUT(sc, ED_P1_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_STA);
+
+ do {
+ /* Get pointer to this buffer's header structure. */
+ packet_ptr = sc->mem_ring +
+ ((sc->next_packet - sc->rec_page_start) << ED_PAGE_SHIFT);
+
+ /*
+ * The byte count includes a 4 byte header that was added by
+ * the NIC.
+ */
+ packet_hdr = *(struct zed_ring *)packet_ptr;
+ packet_hdr.count = ((packet_hdr.count >> 8) & 0xff)
+ | ((packet_hdr.count & 0xff) << 8);
+ len = packet_hdr.count;
+ /*
+ * Try do deal with old, buggy chips that sometimes duplicate
+ * the low byte of the length into the high byte. We do this
+ * by simply ignoring the high byte of the length and always
+ * recalculating it.
+ *
+ * NOTE: sc->next_packet is pointing at the current packet.
+ */
+ if (packet_hdr.next_packet >= sc->next_packet)
+ nlen = (packet_hdr.next_packet - sc->next_packet);
+ else
+ nlen = ((packet_hdr.next_packet - sc->rec_page_start) +
+ (sc->rec_page_stop - sc->next_packet));
+ --nlen;
+ if ((len & ED_PAGE_MASK) + sizeof(packet_hdr) > ZED_PAGE_SIZE)
+ --nlen;
+ len = (len & ED_PAGE_MASK) | (nlen << ZED_PAGE_SHIFT);
+ #ifdef DIAGNOSTIC
+ if (len != packet_hdr.count) {
+ printf("%s: length does not match next packet pointer\n",
+ sc->sc_dev.dv_xname);
+ printf("%s: len %04x nlen %04x start %02x first %02x curr %02x next %02x stop %02x\n",
+ sc->sc_dev.dv_xname, packet_hdr.count, len,
+ sc->rec_page_start, sc->next_packet, current,
+ packet_hdr.next_packet, sc->rec_page_stop);
+ }
+ #endif
+
+ /*
+ * Be fairly liberal about what we allow as a "reasonable"
+ * length so that a [crufty] packet will make it to BPF (and
+ * can thus be analyzed). Note that all that is really
+ * important is that we have a length that will fit into one
+ * mbuf cluster or less; the upper layer protocols can then
+ * figure out the length from their own length field(s).
+ *
+ * MCLBYTES may be less than a valid packet len. Thus
+ * we use a constant that is large enough.
+ */
+ if (len <= 2048 &&
+ packet_hdr.next_packet >= sc->rec_page_start &&
+ packet_hdr.next_packet < sc->rec_page_stop) {
+ /* Go get packet. */
+ zed_get_packet(sc, packet_ptr + sizeof(struct zed_ring),
+ len - sizeof(struct zed_ring));
+ ++sc->sc_arpcom.ac_if.if_ipackets;
+ } else {
+ /* Really BAD. The ring pointers are corrupted. */
+ log(LOG_ERR,
+ "%s: NIC memory corrupt - invalid packet length %d\n",
+ sc->sc_dev.dv_xname, len);
+ ++sc->sc_arpcom.ac_if.if_ierrors;
+ zed_reset(sc);
+ return;
+ }
+
+ /* Update next packet pointer. */
+ sc->next_packet = packet_hdr.next_packet;
+
+ /*
+ * Update NIC boundary pointer - being careful to keep it one
+ * buffer behind (as recommended by NS databook).
+ */
+ boundary = sc->next_packet - 1;
+ if (boundary < sc->rec_page_start)
+ boundary = sc->rec_page_stop - 1;
+ NIC_PUT(sc, ED_P0_BNRY, boundary);
+ } while (sc->next_packet != current);
+
+ goto loop;
+ }
+
+ /* Ethernet interface interrupt processor. */
+ int
+ zedintr(sc)
+ struct zed_softc *sc;
+ {
+ u_char isr;
+
+ /* Set NIC to page 0 registers. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_STA);
+
+ isr = NIC_GET(sc, ED_P0_ISR);
+ if (!isr)
+ return (0);
+
+ /* Loop until there are no more new interrupts. */
+ for (;;) {
+ /*
+ * Reset all the bits that we are 'acknowledging' by writing a
+ * '1' to each bit position that was set.
+ * (Writing a '1' *clears* the bit.)
+ */
+ NIC_PUT(sc, ED_P0_ISR, isr);
+
+ /*
+ * Handle transmitter interrupts. Handle these first because
+ * the receiver will reset the board under some conditions.
+ */
+ if (isr & (ED_ISR_PTX | ZED_ISR_TXE)) {
+ u_char collisions = NIC_GET(sc, ED_P0_NCR) & 0x0f;
+
+ /*
+ * Check for transmit error. If a TX completed with an
+ * error, we end up throwing the packet away. Really
+ * the only error that is possible is excessive
+ * collisions, and in this case it is best to allow the
+ * automatic mechanisms of TCP to backoff the flow. Of
+ * course, with UDP we're screwed, but this is expected
+ * when a network is heavily loaded.
+ */
+ (void) NIC_GET(sc, ED_P0_TSR);
+ if (isr & ED_ISR_TXE) {
+ /*
+ * Excessive collisions (16).
+ */
+ if ((NIC_GET(sc, ED_P0_TSR) & ZED_TSR_ABT)
+ && (collisions == 0)) {
+ /*
+ * When collisions total 16, the P0_NCR
+ * will indicate 0, and the TSR_ABT is
+ * set.
+ */
+ collisions = 16;
+ }
+
+ /* Update output errors counter. */
+ ++sc->sc_arpcom.ac_if.if_oerrors;
+ } else {
+ /*
+ * Update total number of successfully
+ * transmitted packets.
+ */
+ ++sc->sc_arpcom.ac_if.if_opackets;
+ }
+
+ /* Reset TX busy and output active flags. */
+ sc->xmit_busy = 0;
+ sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
+
+ /* Clear watchdog timer. */
+ sc->sc_arpcom.ac_if.if_timer = 0;
+
+ /*
+ * Add in total number of collisions on last
+ * transmission.
+ */
+ sc->sc_arpcom.ac_if.if_collisions += collisions;
+
+ /*
+ * Decrement buffer in-use count if not zero (can only
+ * be zero if a transmitter interrupt occured while not
+ * actually transmitting).
+ * If data is ready to transmit, start it transmitting,
+ * otherwise defer until after handling receiver.
+ */
+ if (sc->txb_inuse && --sc->txb_inuse)
+ zed_xmit(sc);
+ }
+
+ /* Handle receiver interrupts. */
+ if (isr & (ED_ISR_PRX | ZED_ISR_RXE | ZED_ISR_OVW)) {
+ /*
+ * Overwrite warning. In order to make sure that a
+ * lockup of the local DMA hasn't occurred, we reset
+ * and re-init the NIC. The NSC manual suggests only a
+ * partial reset/re-init is necessary - but some chips
+ * seem to want more. The DMA lockup has been seen
+ * only with early rev chips - Methinks this bug was
+ * fixed in later revs. -DG
+ */
+ if (isr & ED_ISR_OVW) {
+ ++sc->sc_arpcom.ac_if.if_ierrors;
+ #ifdef DIAGNOSTIC
+ log(LOG_WARNING,
+ "%s: warning - receiver ring buffer overrun\n",
+ sc->sc_dev.dv_xname);
+ #endif
+ /* Stop/reset/re-init NIC. */
+ zed_reset(sc);
+ } else {
+ /*
+ * Receiver Error. One or more of: CRC error,
+ * frame alignment error FIFO overrun, or
+ * missed packet.
+ */
+ if (isr & ED_ISR_RXE) {
+ ++sc->sc_arpcom.ac_if.if_ierrors;
+ #ifdef ZED_DEBUG
+ printf("%s: receive error %x\n",
+ sc->sc_dev.dv_xname,
+ NIC_GET(sc, ED_P0_RSR));
+ #endif
+ }
+
+ /*
+ * Go get the packet(s).
+ * XXX - Doing this on an error is dubious
+ * because there shouldn't be any data to get
+ * (we've configured the interface to not
+ * accept packets with errors).
+ */
+ zed_rint(sc);
+ }
+ }
+
+ /*
+ * If it looks like the transmitter can take more data, attempt
+ * to start output on the interface. This is done after
+ * handling the receiver to give the receiver priority.
+ */
+ if ((sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE) == 0)
+ zed_start(&sc->sc_arpcom.ac_if);
+
+ /*
+ * Return NIC CR to standard state: page 0, remote DMA
+ * complete, start (toggling the TXP bit off, even if was just
+ * set in the transmit routine, is *okay* - it is 'zedge'
+ * triggered from low to high).
+ */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ZED_CR_PAGE_0 | ZED_CR_STA);
+
+ /*
+ * If the Network Talley Counters overflow, read them to reset
+ * them. It appears that old 8390's won't clear the ISR flag
+ * otherwise - resulting in an infinite loop.
+ */
+ if (isr & ED_ISR_CNT) {
+ (void) NIC_GET(sc, ED_P0_CNTR0);
+ (void) NIC_GET(sc, ED_P0_CNTR1);
+ (void) NIC_GET(sc, ED_P0_CNTR2);
+ }
+
+ isr = NIC_GET(sc, ED_P0_ISR);
+ if (!isr)
+ return (1);
+ }
+ }
+
+ /*
+ * Process an ioctl request. This code needs some work - it looks pretty ugly.
+ */
+ int
+ zed_ioctl(ifp, command, data)
+ register struct ifnet *ifp;
+ u_long command;
+ caddr_t data;
+ {
+ struct zed_softc *sc = zedcd.cd_devs[ifp->if_unit];
+ register struct ifaddr *ifa = (struct ifaddr *)data;
+ struct ifreq *ifr = (struct ifreq *)data;
+ int s, error = 0;
+
+ s = splimp();
+
+ switch (command) {
+
+ case SIOCSIFADDR:
+ ifp->if_flags |= IFF_UP;
+
+ switch (ifa->ifa_addr->sa_family) {
+ #ifdef INET
+ case AF_INET:
+ zed_init(sc);
+ arp_ifinit(&sc->sc_arpcom, ifa);
+ break;
+ #endif
+ #ifdef NS
+ /* XXX - This code is probably wrong. */
+ case AF_NS:
+ {
+ register struct ns_addr *ina = &IA_SNS(ifa)->sns_addr;
+
+ if (ns_nullhost(*ina))
+ ina->x_host =
+ *(union ns_host *)(sc->sc_arpcom.sc_enaddr);
+ else
+ bcopy(ina->x_host.c_host,
+ sc->sc_arpcom.ac_enaddr,
+ sizeof(sc->sc_arpcom.ac_enaddr));
+ /* Set new address. */
+ zed_init(sc);
+ break;
+ }
+ #endif
+ default:
+ zed_init(sc);
+ break;
+ }
+ break;
+
+ case SIOCSIFFLAGS:
+ if ((ifp->if_flags & IFF_UP) == 0 &&
+ (ifp->if_flags & IFF_RUNNING) != 0) {
+ /*
+ * If interface is marked down and it is running, then
+ * stop it.
+ */
+ zed_stop(sc);
+ ifp->if_flags &= ~IFF_RUNNING;
+ } else if ((ifp->if_flags & IFF_UP) != 0 &&
+ (ifp->if_flags & IFF_RUNNING) == 0) {
+ /*
+ * If interface is marked up and it is stopped, then
+ * start it.
+ */
+ zed_init(sc);
+ } else {
+ /*
+ * Reset the interface to pick up changes in any other
+ * flags that affect hardware registers.
+ */
+ zed_stop(sc);
+ zed_init(sc);
+ }
+ break;
+
+ case SIOCADDMULTI:
+ case SIOCDELMULTI:
+ /* Update our multicast list. */
+ error = (command == SIOCADDMULTI) ?
+ ether_addmulti(ifr, &sc->sc_arpcom) :
+ ether_delmulti(ifr, &sc->sc_arpcom);
+
+ if (error == ENETRESET) {
+ /*
+ * Multicast list has changed; set the hardware filter
+ * accordingly.
+ */
+ zed_stop(sc); /* XXX for ds_setmcaf? */
+ zed_init(sc);
+ error = 0;
+ }
+ break;
+
+ default:
+ error = EINVAL;
+ }
+
+ splx(s);
+ return (error);
+ }
+
+ /*
+ * Retreive packet from shared memory and send to the next level up via
+ * ether_input(). If there is a BPF listener, give a copy to BPF, too.
+ */
+ void
+ zed_get_packet(sc, buf, len)
+ struct zed_softc *sc;
+ caddr_t buf;
+ u_short len;
+ {
+ struct ether_header *eh;
+ struct mbuf *m, *zed_ring_to_mbuf();
+
+ /* round length to word boundry */
+ len = (len + 1) & ~1;
+
+ /* Allocate a header mbuf. */
+ MGETHDR(m, M_DONTWAIT, MT_DATA);
+ if (m == 0)
+ return;
+ m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if;
+ m->m_pkthdr.len = len;
+ m->m_len = 0;
+
+ /* The following silliness is to make NFS happy. */
+ #define EROUND ((sizeof(struct ether_header) + 3) & ~3)
+ #define EOFF (EROUND - sizeof(struct ether_header))
+
+ /*
+ * The following assumes there is room for the ether header in the
+ * header mbuf.
+ */
+ m->m_data += EOFF;
+ eh = mtod(m, struct ether_header *);
+
+ word_copy(buf, mtod(m, caddr_t), sizeof(struct ether_header));
+ buf += sizeof(struct ether_header);
+ m->m_len += sizeof(struct ether_header);
+ len -= sizeof(struct ether_header);
+
+ /* Pull packet off interface. */
+ if (zed_ring_to_mbuf(sc, buf, m, len) == 0) {
+ m_freem(m);
+ return;
+ }
+
+ #if NBPFILTER > 0
+ /*
+ * Check if there's a BPF listener on this interface. If so, hand off
+ * the raw packet to bpf.
+ */
+ if (sc->sc_arpcom.ac_if.if_bpf) {
+ bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m);
+
+ /*
+ * Note that the interface cannot be in promiscuous mode if
+ * there are no BPF listeners. And if we are in promiscuous
+ * mode, we have to check if this packet is really ours.
+ */
+ if ((sc->sc_arpcom.ac_if.if_flags & IFF_PROMISC) &&
+ (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
+ bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr,
+ sizeof(eh->ether_dhost)) != 0) {
+ m_freem(m);
+ return;
+ }
+ }
+ #endif
+
+ /* Fix up data start offset in mbuf to point past ether header. */
+ m_adj(m, sizeof(struct ether_header));
+ ether_input(&sc->sc_arpcom.ac_if, eh, m);
+ }
+
+ /*
+ * Supporting routines.
+ */
+
+ /*
+ * Given a source and destination address, copy 'amount' of a packet from the
+ * ring buffer into a linear destination buffer. Takes into account ring-wrap.
+ */
+ static inline caddr_t
+ zed_ring_copy(sc, src, dst, amount)
+ struct zed_softc *sc;
+ caddr_t src, dst;
+ u_short amount;
+ {
+ u_short tmp_amount;
+
+ /* Does copy wrap to lower addr in ring buffer? */
+ if (src + amount > sc->mem_end) {
+ tmp_amount = sc->mem_end - src;
+
+ /* Copy amount up to end of NIC memory. */
+ word_copy(src, dst, tmp_amount);
+
+ amount -= tmp_amount;
+ src = sc->mem_ring;
+ dst += tmp_amount;
+ }
+
+ word_copy(src, dst, amount);
+
+ return (src + amount);
+ }
+
+ /*
+ * Copy data from receive buffer to end of mbuf chain allocate additional mbufs
+ * as needed. Return pointer to last mbuf in chain.
+ * sc = zed info (softc)
+ * src = pointer in zed ring buffer
+ * dst = pointer to last mbuf in mbuf chain to copy to
+ * amount = amount of data to copy
+ */
+ struct mbuf *
+ zed_ring_to_mbuf(sc, src, dst, total_len)
+ struct zed_softc *sc;
+ caddr_t src;
+ struct mbuf *dst;
+ u_short total_len;
+ {
+ register struct mbuf *m = dst;
+
+ /* Round the length to a word boundary. */
+ /* total_len = (total_len + 1) & ~1; */
+
+ while (total_len) {
+ register u_short amount = min(total_len, M_TRAILINGSPACE(m));
+
+ if (amount == 0) {
+ /*
+ * No more data in this mbuf; alloc another.
+ *
+ * If there is enough data for an mbuf cluster, attempt
+ * to allocate one of those, otherwise, a regular mbuf
+ * will do.
+ * Note that a regular mbuf is always required, even if
+ * we get a cluster - getting a cluster does not
+ * allocate any mbufs, and one is needed to assign the
+ * cluster to. The mbuf that has a cluster extension
+ * can not be used to contain data - only the cluster
+ * can contain data.
+ */
+ dst = m;
+ MGET(m, M_DONTWAIT, MT_DATA);
+ if (m == 0)
+ return (0);
+
+ if (total_len >= MINCLSIZE)
+ MCLGET(m, M_DONTWAIT);
+
+ m->m_len = 0;
+ dst->m_next = m;
+ amount = min(total_len, M_TRAILINGSPACE(m));
+ }
+
+ src = zed_ring_copy(sc, src, mtod(m, caddr_t) + m->m_len,
+ amount);
+
+ m->m_len += amount;
+ total_len -= amount;
+ }
+ return (m);
+ }
+
+ /*
+ * Compute the multicast address filter from the list of multicast addresses we
+ * need to listen to.
+ */
+ void
+ zed_getmcaf(ac, af)
+ struct arpcom *ac;
+ u_long *af;
+ {
+ struct ifnet *ifp = &ac->ac_if;
+ struct ether_multi *enm;
+ register u_char *cp, c;
+ register u_long crc;
+ register int i, len;
+ struct ether_multistep step;
+
+ /*
+ * Set up multicast address filter by passing all multicast addresses
+ * through a crc generator, and then using the high order 6 bits as an
+ * index into the 64 bit logical address filter. The high order bit
+ * selects the word, while the rest of the bits select the bit within
+ * the word.
+ */
+
+ if (ifp->if_flags & IFF_PROMISC) {
+ ifp->if_flags |= IFF_ALLMULTI;
+ af[0] = af[1] = 0xffffffff;
+ return;
+ }
+
+ af[0] = af[1] = 0;
+ ETHER_FIRST_MULTI(step, ac, enm);
+ while (enm != NULL) {
+ if (bcmp(enm->enm_addrlo, enm->enm_addrhi,
+ sizeof(enm->enm_addrlo)) != 0) {
+ /*
+ * We must listen to a range of multicast addresses.
+ * For now, just accept all multicasts, rather than
+ * trying to set only those filter bits needed to match
+ * the range. (At this time, the only use of address
+ * ranges is for IP multicast routing, for which the
+ * range is big enough to require all bits set.)
+ */
+ ifp->if_flags |= IFF_ALLMULTI;
+ af[0] = af[1] = 0xffffffff;
+ return;
+ }
+
+ cp = enm->enm_addrlo;
+ crc = 0xffffffff;
+ for (len = sizeof(enm->enm_addrlo); --len >= 0;) {
+ c = *cp++;
+ for (i = 8; --i >= 0;) {
+ if (((crc & 0x80000000) ? 1 : 0) ^ (c & 0x01)) {
+ crc <<= 1;
+ crc ^= 0x04c11db6 | 1;
+ } else
+ crc <<= 1;
+ c >>= 1;
+ }
+ }
+ /* Just want the 6 most significant bits. */
+ crc >>= 26;
+
+ /* Turn on the corresponding bit in the filter. */
+ af[crc >> 5] |= 1 << ((crc & 0x1f) ^ 0);
+
+ ETHER_NEXT_MULTI(step, enm);
+ }
+ ifp->if_flags &= ~IFF_ALLMULTI;
+ }
+
+ /*
+ * Copy packet from mbuf to the board memory
+ *
+ * Currently uses an extra buffer/extra memory copy,
+ * unless the whole packet fits in one mbuf.
+ *
+ */
+ u_short
+ zed_put(sc, m, buf)
+ struct zed_softc *sc;
+ struct mbuf *m;
+ caddr_t buf;
+ {
+ u_char *data, savebyte[2];
+ int len, wantbyte;
+ u_short totlen;
+
+ totlen = wantbyte = 0;
+
+ for (; m != 0; m = m->m_next) {
+ data = mtod(m, u_char *);
+ len = m->m_len;
+ totlen += len;
+ if (len > 0) {
+ /* Finish the last word. */
+ if (wantbyte) {
+ savebyte[1] = *data;
+ word_copy(savebyte, buf, 2);
+ buf += 2;
+ data++;
+ len--;
+ wantbyte = 0;
+ }
+ /* Output contiguous words. */
+ if (len > 1) {
+ word_copy(data, buf, len);
+ buf += len & ~1;
+ data += len & ~1;
+ len &= 1;
+ }
+ /* Save last byte, if necessary. */
+ if (len == 1) {
+ savebyte[0] = *data;
+ wantbyte = 1;
+ }
+ }
+ }
+
+ if (wantbyte) {
+ savebyte[1] = 0;
+ word_copy(savebyte, buf, 2);
+ buf += 2;
+ }
+
+ return (totlen);
+ }
*** /dev/null
--- NetBSD/src/sys/arch/amiga/dev/if_zedreg.h
***************
*** 0 ****
--- 1,43 ----
+ /* $NetBSD: if_edreg.h,v 1.4 1995/05/08 02:40:54 chopps Exp $ */
+
+ /*
+ * Vendor types
+ */
+ #define ED_VENDOR_HYDRA 0x03 /* Hydra Systems */
+
+ /*
+ * Compile-time config flags
+ */
+ /*
+ * This sets the default for enabling/disablng the tranceiver.
+ */
+ #define ED_FLAGS_DISABLE_TRANCEIVER 0x0001
+
+ /*
+ * This forces the board to be used in 8/16-bit mode even if it autoconfigs
+ * differently.
+ */
+ #define ED_FLAGS_FORCE_8BIT_MODE 0x0002
+ #define ED_FLAGS_FORCE_16BIT_MODE 0x0004
+
+ /*
+ * This disables the use of double transmit buffers.
+ */
+ #define ED_FLAGS_NO_MULTI_BUFFERING 0x0008
+
+ /*
+ * This forces all operations with the NIC memory to use Programmed I/O (i.e.
+ * not via shared memory).
+ */
+ #define ED_FLAGS_FORCE_PIO 0x0010
+
+ /*
+ * Definitions for Hydra Systems boards
+ */
+ #define HYDRA_ADDRPROM 0xffc0
+ #define HYDRA_NIC_BASE 0xffe1
+ /*
+ * Definitions for ASDG LANRover boards
+ */
+ #define ASDG_ADDRPROM 0xff
+ #define ASDG_NIC_BASE 0x1
*** /dev/null
--- NetBSD/src/sys/arch/amiga/dev/if_zle.c
***************
*** 0 ****
--- 1,962 ----
+ /* $NetBSD: if_le.c,v 1.14 1995/07/02 00:16:06 mycroft Exp $ */
+
+ /*
+ * Copyright (c) 1982, 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)if_le.c 7.6 (Berkeley) 5/8/91
+ */
+
+ #include "le.h"
+ #if NLE > 0
+
+ #include "bpfilter.h"
+
+ /*
+ * AMD 7990 LANCE
+ *
+ * This driver will generate and accept tailer encapsulated packets even
+ * though it buys us nothing. The motivation was to avoid incompatibilities
+ * with VAXen, SUNs, and others that handle and benefit from them.
+ * This reasoning is dubious.
+ */
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/mbuf.h>
+ #include <sys/buf.h>
+ #include <sys/protosw.h>
+ #include <sys/socket.h>
+ #include <sys/syslog.h>
+ #include <sys/ioctl.h>
+ #include <sys/errno.h>
+ #include <sys/device.h>
+
+ #include <net/if.h>
+ #include <net/netisr.h>
+ #include <net/route.h>
+
+ #ifdef INET
+ #include <netinet/in.h>
+ #include <netinet/in_systm.h>
+ #include <netinet/in_var.h>
+ #include <netinet/ip.h>
+ #include <netinet/if_ether.h>
+ #endif
+
+ #ifdef NS
+ #include <netns/ns.h>
+ #include <netns/ns_if.h>
+ #endif
+
+ #include <machine/cpu.h>
+ #include <machine/mtpr.h>
+ #include <amiga/amiga/device.h>
+ #include <amiga/amiga/isr.h>
+ #include <amiga/dev/zbusvar.h>
+ #include <amiga/dev/if_lereg.h>
+
+ /*
+ * Ethernet software status per interface.
+ *
+ * Each interface is referenced by a network interface structure,
+ * le_if, which the routing code uses to locate the interface.
+ * This structure contains the output queue for the interface, its address, ...
+ */
+ struct le_softc {
+ struct isr sc_isr;
+ struct arpcom sc_ac; /* common Ethernet structures */
+ #define sc_if sc_ac.ac_if /* network-visible interface */
+ #define sc_addr sc_ac.ac_enaddr /* hardware Ethernet address */
+ void *sc_base; /* base address of board */
+ struct lereg1 *sc_r1; /* LANCE registers */
+ struct lereg2 *sc_r2; /* dual-port RAM */
+ int sc_rmd; /* predicted next rmd to process */
+ int sc_tmd; /* next tmd to use */
+ int sc_no_td; /* number of tmds in use */
+ int sc_runt;
+ int sc_jab;
+ int sc_merr;
+ int sc_babl;
+ int sc_cerr;
+ int sc_miss;
+ int sc_xint;
+ int sc_xown;
+ int sc_uflo;
+ int sc_rxlen;
+ int sc_rxoff;
+ int sc_txoff;
+ int sc_busy;
+ short sc_iflags;
+ #if NBPFILTER > 0
+ caddr_t sc_bpf;
+ #endif
+ } le_softc[NLE];
+
+ #if NBPFILTER > 0
+ #include <net/bpf.h>
+ #include <net/bpfdesc.h>
+ #endif
+
+ /* offsets for: ID, REGS, MEM */
+ int lestd[] = { 0, 0x4000, 0x8000 };
+
+ /* console error messages */
+ int ledebug = 0;
+
+ int leioctl __P((struct ifnet *, u_long, caddr_t));
+ int leintr __P((struct le_softc *));
+ void lestart __P((struct ifnet *));
+ void leinit __P((int));
+
+ struct mbuf *leget();
+ extern struct ifnet loif;
+
+ void leattach __P((struct device *, struct device *, void *));
+ int lematch __P((struct device *, struct cfdata *, void *args));
+
+ struct cfdriver lecd = {
+ NULL, "le", (cfmatch_t)lematch, leattach, DV_IFNET,
+ sizeof(struct le_softc), NULL, 0};
+
+ int
+ lematch(pdp, cfp, auxp)
+ struct device *pdp;
+ struct cfdata *cfp;
+ void *auxp;
+ {
+
+ struct zbus_args *zap;
+
+ zap = (struct zbus_args *)auxp;
+
+ /* Commodore ethernet card */
+ if ( zap->manid == 514 && zap->prodid == 112)
+ return(1);
+
+ /* Ameristar ethernet card */
+ if ( zap->manid == 1053 && zap->prodid == 1)
+ return(1);
+
+ return (0);
+ }
+
+ /*
+ * Interface exists: make available by filling in network interface
+ * record. System will initialize the interface when it is ready
+ * to accept packets.
+ */
+ void
+ leattach(pdp, dp, auxp)
+ struct device *pdp, *dp;
+ void *auxp;
+ {
+ register struct lereg0 *ler0;
+ register struct lereg2 *ler2;
+ struct zbus_args *zap;
+ struct lereg2 *lemem = (struct lereg2 *) 0x8000;
+ struct le_softc *le = &le_softc[dp->dv_unit];
+ struct ifnet *ifp = &le->sc_if;
+ char *cp;
+ int i;
+ unsigned long ser;
+ int s = splhigh ();
+
+ zap =(struct zbus_args *)auxp;
+
+ /*
+ * Make config msgs look nicer.
+ */
+ printf("\n");
+
+ ler0 = le->sc_base = zap->va;
+ le->sc_r1 = (struct lereg1 *)(lestd[1] + (int)zap->va);
+ ler2 = le->sc_r2 = (struct lereg2 *)(lestd[2] + (int)zap->va);
+
+ /*
+ * Manufacturer decides the 3 first bytes, i.e. ethernet vendor ID.
+ */
+ if ( zap->manid == 514 && zap->prodid == 112) {
+ /* Commodore 2065 */
+ le->sc_addr[0] = 0x00;
+ le->sc_addr[1] = 0x80;
+ le->sc_addr[2] = 0x10;
+ }
+ if ( zap->manid == 1053 && zap->prodid == 1) {
+ le->sc_addr[0] = 0x00;
+ le->sc_addr[1] = 0x00;
+ le->sc_addr[2] = 0x9f;
+ }
+
+ /*
+ * Serial number for board is used as host ID.
+ */
+ ser = (unsigned long) zap->serno;
+
+ le->sc_addr[3] = (ser >> 16) & 0xff;
+ le->sc_addr[4] = (ser >> 8) & 0xff;
+ le->sc_addr[5] = (ser ) & 0xff;
+
+ #ifdef LE_USE_16K
+ printf("le%d: hardware address %s 16K\n",
+ #else
+ printf("le%d: hardware address %s 32K\n",
+ #endif
+ dp->dv_unit, ether_sprintf(le->sc_addr));
+
+ /*
+ * Setup for transmit/receive
+ */
+ ler2->ler2_mode = LE_MODE;
+ ler2->ler2_padr[0] = le->sc_addr[1];
+ ler2->ler2_padr[1] = le->sc_addr[0];
+ ler2->ler2_padr[2] = le->sc_addr[3];
+ ler2->ler2_padr[3] = le->sc_addr[2];
+ ler2->ler2_padr[4] = le->sc_addr[5];
+ ler2->ler2_padr[5] = le->sc_addr[4];
+ ler2->ler2_ladrf0 = 0;
+ ler2->ler2_ladrf1 = 0;
+ ler2->ler2_rlen = LE_RLEN;
+ ler2->ler2_rdra = (int)lemem->ler2_rmd;
+ ler2->ler2_tlen = LE_TLEN;
+ ler2->ler2_tdra = (int)lemem->ler2_tmd;
+
+ splx (s);
+
+ ifp->if_unit = dp->dv_unit;
+ ifp->if_name = "le";
+ ifp->if_mtu = ETHERMTU;
+ ifp->if_ioctl = leioctl;
+ ifp->if_output = ether_output;
+ ifp->if_start = lestart;
+ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
+
+ #if NBPFILTER > 0
+ bpfattach(&le->sc_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
+ #endif
+ if_attach(ifp);
+ ether_ifattach(ifp);
+
+ le->sc_isr.isr_intr = leintr;
+ le->sc_isr.isr_arg = le;
+ le->sc_isr.isr_ipl = 2;
+ add_isr (&le->sc_isr);
+
+ le->sc_isr.isr_intr = leintr;
+ le->sc_isr.isr_arg = le;
+ le->sc_isr.isr_ipl = 2;
+ add_isr (&le->sc_isr);
+
+ return;
+ }
+
+ ledrinit(ler2)
+ register struct lereg2 *ler2;
+ {
+ register struct lereg2 *lemem = (struct lereg2 *) 0x8000;
+ register int i;
+
+ for (i = 0; i < LERBUF; i++) {
+ ler2->ler2_rmd[i].rmd0 = (int)lemem->ler2_rbuf[i];
+ ler2->ler2_rmd[i].rmd1 = LE_OWN;
+ ler2->ler2_rmd[i].rmd2 = -LEMTU;
+ ler2->ler2_rmd[i].rmd3 = 0;
+ }
+
+ for (i = 0; i < LETBUF; i++) {
+ ler2->ler2_tmd[i].tmd0 = (int)lemem->ler2_tbuf[i];
+ ler2->ler2_tmd[i].tmd1 = 0;
+ ler2->ler2_tmd[i].tmd2 = 0;
+ ler2->ler2_tmd[i].tmd3 = 0;
+ }
+ }
+
+ void
+ lereset(unit)
+ register int unit;
+ {
+ register struct le_softc *le = &le_softc[unit];
+ register struct lereg1 *ler1 = le->sc_r1;
+ /*
+ * This structure is referenced from the CARDS/LANCE point of
+ * view, thus the 0x8000 address which is the buffer RAM area of
+ * the Commodore and Ameristar cards. This pointer is manipulated
+ * with the LANCE's view of memory and NOT the Amiga's. FYI.
+ */
+ register struct lereg2 *lemem = (struct lereg2 *) 0x8000;
+
+ register int timo = 100000;
+ register int stat;
+
+ #ifdef lint
+ stat = unit;
+ #endif
+ #if NBPFILTER > 0
+ if (le->sc_if.if_flags & IFF_PROMISC)
+ /* set the promiscuous bit */
+ le->sc_r2->ler2_mode = LE_MODE|0x8000;
+ else
+ le->sc_r2->ler2_mode = LE_MODE;
+ #endif
+ ler1->ler1_rap = LE_CSR0;
+ ler1->ler1_rdp = LE_STOP;
+
+ ledrinit(le->sc_r2);
+
+ le->sc_rmd = le->sc_tmd = le->sc_no_td = 0;
+ ler1->ler1_rap = LE_CSR1;
+ ler1->ler1_rdp = (int)&lemem->ler2_mode;
+ ler1->ler1_rap = LE_CSR2;
+ ler1->ler1_rdp = 0;
+ ler1->ler1_rap = LE_CSR0;
+ ler1->ler1_rdp = LE_INIT;
+
+ do {
+ if (--timo == 0) {
+ printf("le%d: init timeout, stat = 0x%x\n",
+ unit, stat);
+ break;
+ }
+ stat = ler1->ler1_rdp;
+ } while ((stat & LE_IDON) == 0);
+
+ ler1->ler1_rdp = LE_STOP;
+ ler1->ler1_rap = LE_CSR3;
+ ler1->ler1_rdp = LE_BSWP;
+ ler1->ler1_rap = LE_CSR0;
+ ler1->ler1_rdp = LE_STRT | LE_INEA;
+ le->sc_if.if_flags &= ~IFF_OACTIVE;
+
+ return;
+ }
+
+ /*
+ * Initialization of interface
+ */
+ void
+ leinit(unit)
+ int unit;
+ {
+ struct le_softc *le = &le_softc[unit];
+ register struct ifnet *ifp = &le->sc_if;
+ int s;
+
+ if ((ifp->if_flags & IFF_RUNNING) == 0) {
+ s = splimp();
+ ifp->if_flags |= IFF_RUNNING;
+ lereset(unit);
+ (void) lestart(ifp);
+ splx(s);
+ }
+
+ return;
+ }
+
+ #define LENEXTTMP \
+ if (++bix == LETBUF) bix = 0, tmd = le->sc_r2->ler2_tmd; else ++tmd
+
+ /*
+ * Start output on interface. Get another datagram to send
+ * off of the interface queue, and copy it to the interface
+ * before starting the output.
+ */
+ void
+ lestart(ifp)
+ struct ifnet *ifp;
+ {
+ register struct le_softc *le = &le_softc[ifp->if_unit];
+ register int bix;
+ register struct letmd *tmd;
+ register struct mbuf *m;
+ int len;
+
+ if ((le->sc_if.if_flags & IFF_RUNNING) == 0)
+ return;
+
+ bix = le->sc_tmd;
+ tmd = &le->sc_r2->ler2_tmd[bix];
+
+ for (;;) {
+ if (le->sc_no_td >= LETBUF) {
+ le->sc_if.if_flags |= IFF_OACTIVE;
+ break;
+ }
+
+ IF_DEQUEUE(&le->sc_if.if_snd, m);
+ if (m == 0)
+ break;
+
+ ++le->sc_no_td;
+
+ len = leput(le->sc_r2->ler2_tbuf[bix], m);
+
+ #if NBPFILTER > 0
+ /*
+ * If bpf is listening on this interface, let it
+ * see the packet before we commit it to the wire.
+ */
+ if (le->sc_bpf)
+ bpf_tap(le->sc_bpf, le->sc_r2->ler2_tbuf[bix], len);
+ #endif
+
+ tmd->tmd3 = 0;
+ tmd->tmd2 = -len;
+ tmd->tmd1 = LE_OWN | LE_STP | LE_ENP;
+
+ LENEXTTMP;
+ }
+
+ le->sc_tmd = bix;
+ }
+
+ int
+ leintr(le)
+ struct le_softc *le;
+ {
+ #if 0
+ register struct le_softc *le = &le_softc[unit];
+ #else
+ int unit = le->sc_if.if_unit;
+ #endif
+ register struct lereg1 *ler1;
+ register int stat;
+
+ /* if not even initialized, don't do anything further.. */
+ if (! le->sc_base)
+ return 0;
+
+ ler1 = le->sc_r1;
+ stat = ler1->ler1_rdp;
+
+ if (! (stat & LE_INTR))
+ return 0;
+
+ if (stat & LE_SERR) {
+ leerror(unit, stat);
+ if (stat & LE_MERR) {
+ le->sc_merr++;
+ lereset(unit);
+ return(1);
+ }
+ if (stat & LE_BABL)
+ le->sc_babl++;
+ if (stat & LE_CERR)
+ le->sc_cerr++;
+ if (stat & LE_MISS)
+ le->sc_miss++;
+ ler1->ler1_rdp = LE_BABL|LE_CERR|LE_MISS|LE_INEA;
+ }
+ if ((stat & LE_RXON) == 0) {
+ le->sc_rxoff++;
+ lereset(unit);
+ return(1);
+ }
+ if ((stat & LE_TXON) == 0) {
+ le->sc_txoff++;
+ lereset(unit);
+ return(1);
+ }
+ if (stat & LE_RINT) {
+ /* interrupt is cleared in lerint */
+ lerint(unit);
+ }
+ if (stat & LE_TINT) {
+ ler1->ler1_rdp = LE_TINT|LE_INEA;
+ lexint(unit);
+ }
+ return(1);
+ }
+
+ /*
+ * Ethernet interface transmitter interrupt.
+ * Start another output if more data to send.
+ */
+ lexint(unit)
+ register int unit;
+ {
+ register struct le_softc *le = &le_softc[unit];
+ register int bix = (le->sc_tmd - le->sc_no_td + LETBUF) % LETBUF;
+ register struct letmd *tmd = &le->sc_r2->ler2_tmd[bix];
+
+ if ((le->sc_if.if_flags & IFF_OACTIVE) == 0) {
+ le->sc_xint++;
+ return;
+ }
+ if (tmd->tmd1 & LE_OWN) {
+ printf("le%d: extra xint\n", unit);
+ le->sc_xown++;
+ return;
+ }
+ le->sc_if.if_flags &= ~IFF_OACTIVE;
+
+ do {
+ if (le->sc_no_td <= 0)
+ break;
+ --le->sc_no_td;
+
+ if (tmd->tmd1 & LE_ERR) {
+ err:
+ printf("le%d: xint error\n", unit);
+ lexerror(unit);
+ le->sc_if.if_oerrors++;
+ if (tmd->tmd3 & (LE_TBUFF|LE_UFLO)) {
+ le->sc_uflo++;
+ lereset(unit);
+ return;
+ }
+ else if (tmd->tmd3 & LE_LCOL)
+ le->sc_if.if_collisions++;
+ else if (tmd->tmd3 & LE_RTRY)
+ le->sc_if.if_collisions += 16;
+ }
+ else if (tmd->tmd3 & LE_TBUFF)
+ /* XXX documentation says BUFF not included in ERR */
+ goto err;
+ else if (tmd->tmd1 & LE_ONE)
+ le->sc_if.if_collisions++;
+ else if (tmd->tmd1 & LE_MORE)
+ /* what is the real number? */
+ le->sc_if.if_collisions += 2;
+ else
+ le->sc_if.if_opackets++;
+ LENEXTTMP;
+ } while ((tmd->tmd1 & LE_OWN) == 0);
+
+ (void) lestart(&le->sc_if);
+ }
+
+ #define LENEXTRMP \
+ if (++bix == LERBUF) bix = 0, rmd = le->sc_r2->ler2_rmd; else ++rmd
+
+ /*
+ * Ethernet interface receiver interrupt.
+ * If input error just drop packet.
+ * Decapsulate packet based on type and pass to type specific
+ * higher-level input routine.
+ */
+ lerint(unit)
+ int unit;
+ {
+ register struct le_softc *le = &le_softc[unit];
+ register int bix = le->sc_rmd;
+ register struct lermd *rmd = &le->sc_r2->ler2_rmd[bix];
+
+ /*
+ * Out of sync with hardware, should never happen?
+ */
+ if (rmd->rmd1 & LE_OWN) {
+ le->sc_r1->ler1_rdp = LE_RINT|LE_INEA;
+ return;
+ }
+
+ /*
+ * Process all buffers with valid data
+ */
+ while ((rmd->rmd1 & LE_OWN) == 0) {
+ int len = rmd->rmd3;
+
+ /* Clear interrupt to avoid race condition */
+ le->sc_r1->ler1_rdp = LE_RINT|LE_INEA;
+
+ if (rmd->rmd1 & LE_ERR) {
+ le->sc_rmd = bix;
+ lererror(unit, "bad packet");
+ le->sc_if.if_ierrors++;
+ } else if ((rmd->rmd1 & (LE_STP|LE_ENP)) != (LE_STP|LE_ENP)) {
+ /*
+ * Find the end of the packet so we can see how long
+ * it was. We still throw it away.
+ */
+ do {
+ le->sc_r1->ler1_rdp = LE_RINT|LE_INEA;
+ rmd->rmd3 = 0;
+ rmd->rmd1 = LE_OWN;
+ LENEXTRMP;
+ } while (!(rmd->rmd1 & (LE_OWN|LE_ERR|LE_STP|LE_ENP)));
+
+ le->sc_rmd = bix;
+ lererror(unit, "chained buffer");
+ le->sc_rxlen++;
+
+ /*
+ * If search terminated without successful completion
+ * we reset the hardware (conservative).
+ */
+ if ((rmd->rmd1 & (LE_OWN|LE_ERR|LE_STP|LE_ENP)) != LE_ENP) {
+ lereset(unit);
+ return;
+ }
+ } else
+ leread(unit, le->sc_r2->ler2_rbuf[bix], len);
+
+ rmd->rmd3 = 0;
+ rmd->rmd1 = LE_OWN;
+ LENEXTRMP;
+
+ }
+
+ le->sc_rmd = bix;
+ }
+
+ leread(unit, buf, len)
+ int unit;
+ char *buf;
+ int len;
+ {
+ register struct le_softc *le = &le_softc[unit];
+ register struct ether_header *et;
+ struct mbuf *m;
+ int off, resid;
+
+ le->sc_if.if_ipackets++;
+
+ et = (struct ether_header *)buf;
+ et->ether_type = ntohs((u_short)et->ether_type);
+
+ /* adjust input length to account for header and CRC */
+ len = len - sizeof(struct ether_header) - 4;
+
+ #define ledataaddr(et, off, type) ((type)(((caddr_t)((et)+1)+(off))))
+ if (et->ether_type >= ETHERTYPE_TRAIL &&
+ et->ether_type < ETHERTYPE_TRAIL+ETHERTYPE_NTRAILER) {
+ off = (et->ether_type - ETHERTYPE_TRAIL) * 512;
+ if (off >= ETHERMTU)
+ return; /* sanity */
+ et->ether_type = ntohs(*ledataaddr(et, off, u_short *));
+ resid = ntohs(*(ledataaddr(et, off+2, u_short *)));
+ if (off + resid > len)
+ return; /* sanity */
+ len = off + resid;
+ } else
+ off = 0;
+
+ if (len <= 0) {
+ if (ledebug)
+ log(LOG_WARNING,
+ "le%d: ierror(runt packet): from %s: len=%d\n",
+ unit, ether_sprintf(et->ether_shost), len);
+ le->sc_runt++;
+ le->sc_if.if_ierrors++;
+ return;
+ }
+ #if NBPFILTER > 0
+ /*
+ * Check if there's a bpf filter listening on this interface.
+ * If so, hand off the raw packet to bpf, which must deal with
+ * trailers in its own way.
+ */
+ if (le->sc_bpf) {
+ bpf_tap(le->sc_bpf, buf, len + sizeof(struct ether_header));
+
+ /*
+ * Note that the interface cannot be in promiscuous mode if
+ * there are no bpf listeners. And if we are in promiscuous
+ * mode, we have to check if this packet is really ours.
+ *
+ * XXX This test does not support multicasts.
+ */
+ if ((le->sc_if.if_flags & IFF_PROMISC)
+ && bcmp(et->ether_dhost, le->sc_addr,
+ sizeof(et->ether_dhost)) != 0
+ && bcmp(et->ether_dhost, etherbroadcastaddr,
+ sizeof(et->ether_dhost)) != 0)
+ return;
+ }
+ #endif
+ /*
+ * Pull packet off interface. Off is nonzero if packet
+ * has trailing header; leget will then force this header
+ * information to be at the front, but we still have to drop
+ * the type and length which are at the front of any trailer data.
+ */
+ m = leget(buf, len, off, &le->sc_if);
+ if (m == 0)
+ return;
+
+ ether_input(&le->sc_if, et, m);
+ }
+
+ /*
+ * Routine to copy from mbuf chain to transmit
+ * buffer in board local memory.
+ */
+ leput(lebuf, m)
+ register char *lebuf;
+ register struct mbuf *m;
+ {
+ register struct mbuf *mp;
+ register int len, tlen = 0;
+
+ for (mp = m; mp; mp = mp->m_next) {
+ len = mp->m_len;
+ if (len == 0)
+ continue;
+ tlen += len;
+ bcopy(mtod(mp, char *), lebuf, len);
+ lebuf += len;
+ }
+
+ m_freem(m);
+
+ if (tlen < LEMINSIZE) {
+ bzero(lebuf, LEMINSIZE - tlen);
+ tlen = LEMINSIZE;
+ }
+
+ return(tlen);
+ }
+
+ /*
+ * Routine to copy from board local memory into mbufs.
+ */
+ struct mbuf *
+ leget(lebuf, totlen, off0, ifp)
+ char *lebuf;
+ int totlen, off0;
+ struct ifnet *ifp;
+ {
+ register struct mbuf *m;
+ struct mbuf *top = 0, **mp = ⊤
+ register int off = off0, len;
+ register char *cp;
+ char *epkt;
+
+ lebuf += sizeof (struct ether_header);
+ cp = lebuf;
+ epkt = cp + totlen;
+ if (off) {
+ cp += off + 2 * sizeof(u_short);
+ totlen -= 2 * sizeof(u_short);
+ }
+
+ MGETHDR(m, M_DONTWAIT, MT_DATA);
+
+ if (m == 0)
+ return (0);
+
+ m->m_pkthdr.rcvif = ifp;
+ m->m_pkthdr.len = totlen;
+ m->m_len = MHLEN;
+
+ while (totlen > 0) {
+
+ if (top) {
+ MGET(m, M_DONTWAIT, MT_DATA);
+ if (m == 0) {
+ m_freem(top);
+ return (0);
+ }
+ m->m_len = MLEN;
+ }
+
+ len = min(totlen, epkt - cp);
+ if (len >= MINCLSIZE) {
+ MCLGET(m, M_DONTWAIT);
+ if (m->m_flags & M_EXT)
+ m->m_len = len = min(len, MCLBYTES);
+ else
+ len = m->m_len;
+ } else {
+ /*
+ * Place initial small packet/header at end of mbuf.
+ */
+ if (len < m->m_len) {
+ if (top == 0 && len + max_linkhdr <= m->m_len)
+ m->m_data += max_linkhdr;
+ m->m_len = len;
+ } else
+ len = m->m_len;
+ }
+
+ bcopy(cp, mtod(m, caddr_t), (unsigned)len);
+ cp += len;
+ *mp = m;
+ mp = &m->m_next;
+ totlen -= len;
+
+ if (cp == epkt)
+ cp = lebuf;
+
+ }
+
+ return (top);
+ }
+
+ /*
+ * Process an ioctl request.
+ */
+ int
+ leioctl(ifp, cmd, data)
+ register struct ifnet *ifp;
+ u_long cmd;
+ caddr_t data;
+ {
+ register struct ifaddr *ifa = (struct ifaddr *)data;
+ struct le_softc *le = &le_softc[ifp->if_unit];
+ struct lereg1 *ler1 = le->sc_r1;
+ int s = splimp(), error = 0;
+
+ switch (cmd) {
+
+ case SIOCSIFADDR:
+ ifp->if_flags |= IFF_UP;
+ switch (ifa->ifa_addr->sa_family) {
+ #ifdef INET
+ case AF_INET:
+ leinit(ifp->if_unit);
+ arp_ifinit(&le->sc_ac, ifa);
+ break;
+ #endif
+ #ifdef NS
+ case AF_NS:
+ {
+ register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
+
+ if (ns_nullhost(*ina))
+ ina->x_host = *(union ns_host *)(le->sc_addr);
+ else {
+ /*
+ * The manual says we can't change the address
+ * while the receiver is armed,
+ * so reset everything
+ */
+ ifp->if_flags &= ~IFF_RUNNING;
+ bcopy((caddr_t)ina->x_host.c_host,
+ (caddr_t)le->sc_addr, sizeof(le->sc_addr));
+ }
+ leinit(ifp->if_unit); /* does le_setaddr() */
+ break;
+ }
+ #endif
+ default:
+ leinit(ifp->if_unit);
+ break;
+ }
+ break;
+
+ case SIOCSIFFLAGS:
+ if ((ifp->if_flags & IFF_UP) == 0 &&
+ ifp->if_flags & IFF_RUNNING) {
+ ler1->ler1_rdp = LE_STOP;
+ ifp->if_flags &= ~IFF_RUNNING;
+ } else if (ifp->if_flags & IFF_UP && (ifp->if_flags & IFF_RUNNING) == 0)
+ leinit(ifp->if_unit);
+
+ /*
+ * If the state of the promiscuous bit changes, the interface
+ * must be reset to effect the change.
+ */
+ if (((ifp->if_flags ^ le->sc_iflags) & IFF_PROMISC) && (ifp->if_flags & IFF_RUNNING)) {
+ le->sc_iflags = ifp->if_flags;
+ lereset(ifp->if_unit);
+ lestart(ifp);
+ }
+ break;
+
+ default:
+ error = EINVAL;
+ }
+
+ splx(s);
+ return (error);
+ }
+
+ leerror(unit, stat)
+ int unit;
+ int stat;
+ {
+ if (!ledebug)
+ return;
+
+ /*
+ * Not all transceivers implement heartbeat
+ * so we only log CERR once.
+ */
+ if ((stat & LE_CERR) && le_softc[unit].sc_cerr)
+ return;
+
+ log(LOG_WARNING,
+ "le%d: error: stat=%b\n", unit,
+ stat,
+ "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT");
+ }
+
+ lererror(unit, msg)
+ int unit;
+ char *msg;
+ {
+ register struct le_softc *le = &le_softc[unit];
+ register struct lermd *rmd;
+ int len;
+
+ if (!ledebug)
+ return;
+
+ rmd = &le->sc_r2->ler2_rmd[le->sc_rmd];
+ len = rmd->rmd3;
+
+ log(LOG_WARNING,
+ "le%d: ierror(%s): from %s: buf=%d, len=%d, rmd1=%b\n",
+ unit, msg,
+ len > 11 ? ether_sprintf(&le->sc_r2->ler2_rbuf[le->sc_rmd][6]) : "unknown",
+ le->sc_rmd, len,
+ rmd->rmd1,
+ "\20\20OWN\17ERR\16FRAM\15OFLO\14CRC\13RBUF\12STP\11ENP");
+ }
+
+ lexerror(unit)
+ int unit;
+ {
+ register struct le_softc *le = &le_softc[unit];
+ int bix;
+ register struct letmd *tmd;
+ int len;
+
+ if (!ledebug)
+ return;
+
+ bix = (le->sc_tmd - le->sc_no_td + LETBUF) % LETBUF;
+ tmd = &le->sc_r2->ler2_tmd[bix];
+ len = -tmd->tmd2;
+
+ log(LOG_WARNING,
+ "le%d: oerror: to %s: buf=%d, len=%d, tmd1=%b, tmd3=%b\n",
+ unit,
+ len > 5 ? ether_sprintf(&le->sc_r2->ler2_tbuf[0][0]) : "unknown",
+ 0, len,
+ tmd->tmd1,
+ "\20\20OWN\17ERR\16RES\15MORE\14ONE\13DEF\12STP\11ENP",
+ tmd->tmd3,
+ "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY");
+ }
+
+ #endif
+
+
*** /dev/null
--- NetBSD/src/sys/arch/amiga/dev/if_zlereg.h
***************
*** 0 ****
--- 1,175 ----
+ /* $NetBSD: if_lereg.h,v 1.5 1994/12/28 09:25:30 chopps Exp $ */
+
+ /*
+ * Copyright (c) 1982, 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)if_lereg.h 7.1 (Berkeley) 5/8/90
+ */
+
+ #define LEID 21
+
+ #define LEMTU 1518
+ #define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
+
+ /* HP seems to have 16K RAM on board, A2065/Ameristar come with 32K.
+ First try to get a working driver with the HP values, and later
+ try and see whether 32K works too. */
+ #define LE_USE_32K
+
+ #ifdef LE_USE_16K
+ #define LERBUF 8
+ #define LERBUFLOG2 3
+ #define LETBUF 4
+ #define LETBUFLOG2 2
+ #else /* 32K */
+ #define LERBUF 16
+ #define LERBUFLOG2 4
+ #define LETBUF 4
+ #define LETBUFLOG2 2
+ #endif
+
+ #define LE_RLEN (LERBUFLOG2 << 13)
+ #define LE_TLEN (LETBUFLOG2 << 13)
+
+ #define vu_char volatile u_char
+
+ /*
+ * LANCE registers.
+ */
+ #if 0
+ /* doesn't exist on amiga, there's autoconfig registers in this area */
+ struct lereg0 {
+ u_char ler0_pad0;
+ vu_char ler0_id; /* ID */
+ u_char ler0_pad1;
+ vu_char ler0_status; /* interrupt enable/status */
+ };
+ #endif
+
+ struct lereg1 {
+ u_short ler1_rdp; /* data port */
+ u_short ler1_rap; /* register select port */
+ };
+
+ /*
+ * Overlayed on 16K dual-port RAM.
+ * Current size is 13,758 bytes with 8 x 1518 receive buffers and
+ * 1 x 1518 transmit buffer.
+ */
+ struct lereg2 {
+ /* init block */
+ u_short ler2_mode; /* +0x0000 */
+ u_char ler2_padr[6]; /* +0x0002 */
+ u_long ler2_ladrf0; /* +0x0008 */
+ u_long ler2_ladrf1; /* +0x000C */
+ u_short ler2_rdra; /* +0x0010 */
+ u_short ler2_rlen; /* +0x0012 */
+ u_short ler2_tdra; /* +0x0014 */
+ u_short ler2_tlen; /* +0x0016 */
+ /* receive message descriptors */
+ struct lermd { /* +0x0018 */
+ u_short rmd0;
+ u_short rmd1;
+ short rmd2;
+ u_short rmd3;
+ } ler2_rmd[LERBUF];
+ /* transmit message descriptors */
+ struct letmd { /* +0x0058 */
+ u_short tmd0;
+ u_short tmd1;
+ short tmd2;
+ u_short tmd3;
+ } ler2_tmd[LETBUF];
+ char ler2_rbuf[LERBUF][LEMTU]; /* +0x0060 */
+ char ler2_tbuf[LETBUF][LEMTU]; /* +0x2FD0 */
+ };
+
+ #if 0
+ /*
+ * Control and status bits -- lereg0
+ */
+ #define LE_IE 0x80 /* interrupt enable */
+ #define LE_IR 0x40 /* interrupt requested */
+ #define LE_LOCK 0x08 /* lock status register */
+ #define LE_ACK 0x04 /* ack of lock */
+ #define LE_JAB 0x02 /* loss of tx clock (???) */
+ #define LE_IPL(x) ((((x) >> 4) & 0x3) + 3)
+ #endif
+
+ /*
+ * Control and status bits -- lereg1
+ */
+ #define LE_CSR0 0
+ #define LE_CSR1 1
+ #define LE_CSR2 2
+ #define LE_CSR3 3
+
+ #define LE_SERR 0x8000
+ #define LE_BABL 0x4000
+ #define LE_CERR 0x2000
+ #define LE_MISS 0x1000
+ #define LE_MERR 0x0800
+ #define LE_RINT 0x0400
+ #define LE_TINT 0x0200
+ #define LE_IDON 0x0100
+ #define LE_INTR 0x0080
+ #define LE_INEA 0x0040
+ #define LE_RXON 0x0020
+ #define LE_TXON 0x0010
+ #define LE_TDMD 0x0008
+ #define LE_STOP 0x0004
+ #define LE_STRT 0x0002
+ #define LE_INIT 0x0001
+
+ #define LE_BSWP 0x4
+ #define LE_MODE 0x0
+
+ /*
+ * Control and status bits -- lereg2
+ */
+ #define LE_OWN 0x8000
+ #define LE_ERR 0x4000
+ #define LE_STP 0x0200
+ #define LE_ENP 0x0100
+
+ #define LE_FRAM 0x2000
+ #define LE_OFLO 0x1000
+ #define LE_CRC 0x0800
+ #define LE_RBUFF 0x0400
+ #define LE_MORE 0x1000
+ #define LE_ONE 0x0800
+ #define LE_DEF 0x0400
+ #define LE_TBUFF 0x8000
+ #define LE_UFLO 0x4000
+ #define LE_LCOL 0x1000
+ #define LE_LCAR 0x0800
+ #define LE_RTRY 0x0400
*** old-NetBSD/src/sys/arch/amiga/dev/ite.c
--- NetBSD/src/sys/arch/amiga/dev/ite.c
***************
*** 295,306 ****
}
/*
! * ite_cnfinish() is called in ite_init() when the device is
* being probed in the normal fasion, thus we can finish setting
* up this ite now that the system is more functional.
*/
void
! ite_cnfinish(ip)
struct ite_softc *ip;
{
static int done;
--- 295,306 ----
}
/*
! * itecnfinish() is called in iteinit() when the device is
* being probed in the normal fasion, thus we can finish setting
* up this ite now that the system is more functional.
*/
void
! itecnfinish(ip)
struct ite_softc *ip;
{
static int done;
*** old-NetBSD/src/sys/arch/amiga/dev/itevar.h
--- NetBSD/src/sys/arch/amiga/dev/itevar.h
***************
*** 193,199 ****
void itecninit __P((struct consdev *));
int itecngetc __P((dev_t));
void itecnputc __P((dev_t, int));
! void ite_cnfinish __P((struct ite_softc *));
/* standard ite device entry points. */
void iteinit __P((dev_t));
--- 193,200 ----
void itecninit __P((struct consdev *));
int itecngetc __P((dev_t));
void itecnputc __P((dev_t, int));
! void itecnfinish __P((struct ite_softc *));
! void itecnpollc __P((dev_t dev,int on));
/* standard ite device entry points. */
void iteinit __P((dev_t));
*** old-NetBSD/src/sys/arch/amiga/dev/kbd.c
--- NetBSD/src/sys/arch/amiga/dev/kbd.c
***************
*** 54,59 ****
--- 54,60 ----
#include <amiga/dev/event_var.h>
#include <amiga/dev/vuid_event.h>
#include "kbd.h"
+ #include "grfcc.h"
struct kbd_softc {
int k_event_mode; /* if true, collect events, else pass to ite */
*** /dev/null
--- NetBSD/src/sys/arch/amiga/dev/kf_custom.c
***************
*** 0 ****
--- 1,247 ----
+ /*
+ Information on selected font:
+ Name=topaz.font
+ Height=8 tf_Style=0 tf_Flags=41 Width=8 Baseline=6
+ */
+ /* Generated automatically by fontdumper.c. *DONT* distribute
+ this file, it may contain information Copyright by Commodore!
+
+ Font: topaz.font/8
+ */
+
+ unsigned char kernel_font_width = 8;
+ unsigned char kernel_font_height = 8;
+ unsigned char kernel_font_baseline = 6;
+ short kernel_font_boldsmear = 1;
+ unsigned char kernel_font_lo = 32;
+ unsigned char kernel_font_hi = 255;
+
+ unsigned char kernel_cursor[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+
+ unsigned char kernel_font[] = {
+ /* */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* ! */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00,
+ /* " */ 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* # */ 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00,
+ /* $ */ 0x18, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x18, 0x00,
+ /* % */ 0x00, 0x66, 0xac, 0xd8, 0x36, 0x6a, 0xcc, 0x00,
+ /* & */ 0x38, 0x6c, 0x68, 0x76, 0xdc, 0xce, 0x7b, 0x00,
+ /* ' */ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* ( */ 0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00,
+ /* ) */ 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00,
+ /* * */ 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00,
+ /* + */ 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00,
+ /* , */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30,
+ /* - */ 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
+ /* . */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
+ /* / */ 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00,
+ /* 0 */ 0x3c, 0x66, 0x6e, 0x7e, 0x76, 0x66, 0x3c, 0x00,
+ /* 1 */ 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x00,
+ /* 2 */ 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x30, 0x7e, 0x00,
+ /* 3 */ 0x3c, 0x66, 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00,
+ /* 4 */ 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x00,
+ /* 5 */ 0x7e, 0x60, 0x7c, 0x06, 0x06, 0x66, 0x3c, 0x00,
+ /* 6 */ 0x1c, 0x30, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00,
+ /* 7 */ 0x7e, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x00,
+ /* 8 */ 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00,
+ /* 9 */ 0x3c, 0x66, 0x66, 0x3e, 0x06, 0x0c, 0x38, 0x00,
+ /* : */ 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00,
+ /* ; */ 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30,
+ /* < */ 0x00, 0x06, 0x18, 0x60, 0x18, 0x06, 0x00, 0x00,
+ /* = */ 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
+ /* > */ 0x00, 0x60, 0x18, 0x06, 0x18, 0x60, 0x00, 0x00,
+ /* ? */ 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00,
+ /* @ */ 0x7c, 0xc6, 0xde, 0xd6, 0xde, 0xc0, 0x78, 0x00,
+ /* A */ 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00,
+ /* B */ 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00,
+ /* C */ 0x1e, 0x30, 0x60, 0x60, 0x60, 0x30, 0x1e, 0x00,
+ /* D */ 0x78, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x00,
+ /* E */ 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7e, 0x00,
+ /* F */ 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00,
+ /* G */ 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00,
+ /* H */ 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00,
+ /* I */ 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00,
+ /* J */ 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00,
+ /* K */ 0xc6, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0xc6, 0x00,
+ /* L */ 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00,
+ /* M */ 0xc6, 0xee, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0x00,
+ /* N */ 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00,
+ /* O */ 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* P */ 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00,
+ /* Q */ 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x7e, 0x00,
+ /* R */ 0x7c, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x00,
+ /* S */ 0x3c, 0x66, 0x70, 0x3c, 0x0e, 0x66, 0x3c, 0x00,
+ /* T */ 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
+ /* U */ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* V */ 0x66, 0x66, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x00,
+ /* W */ 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6, 0x00,
+ /* X */ 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00,
+ /* Y */ 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x00,
+ /* Z */ 0xfe, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xfe, 0x00,
+ /* [ */ 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00,
+ /* \ */ 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x00,
+ /* ] */ 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00,
+ /* ^ */ 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
+ /* _ */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe,
+ /* ` */ 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* a */ 0x00, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
+ /* b */ 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x00,
+ /* c */ 0x00, 0x00, 0x3c, 0x60, 0x60, 0x60, 0x3c, 0x00,
+ /* d */ 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x00,
+ /* e */ 0x00, 0x00, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
+ /* f */ 0x1c, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x30, 0x00,
+ /* g */ 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x3c,
+ /* h */ 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00,
+ /* i */ 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x00,
+ /* j */ 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x78,
+ /* k */ 0x60, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x00,
+ /* l */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x00,
+ /* m */ 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xc6, 0xc6, 0x00,
+ /* n */ 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00,
+ /* o */ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* p */ 0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60,
+ /* q */ 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x06,
+ /* r */ 0x00, 0x00, 0x7c, 0x66, 0x60, 0x60, 0x60, 0x00,
+ /* s */ 0x00, 0x00, 0x3c, 0x60, 0x3c, 0x06, 0x7c, 0x00,
+ /* t */ 0x30, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x1c, 0x00,
+ /* u */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00,
+ /* v */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00,
+ /* w */ 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00,
+ /* x */ 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00,
+ /* y */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x30,
+ /* z */ 0x00, 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00,
+ /* { */ 0x0e, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0e, 0x00,
+ /* | */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
+ /* } */ 0x70, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x70, 0x00,
+ /* ~ */ 0x72, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* */ 0x0f, 0x3c, 0xf0, 0xc3, 0x0f, 0x3c, 0xf0, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00,
+ /* */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* ¡ */ 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
+ /* ¢ */ 0x00, 0x0c, 0x3e, 0x6c, 0x3e, 0x0c, 0x00, 0x00,
+ /* £ */ 0x1c, 0x36, 0x30, 0x78, 0x30, 0x30, 0x7e, 0x00,
+ /* ¤ */ 0x42, 0x3c, 0x66, 0x3c, 0x42, 0x00, 0x00, 0x00,
+ /* ¥ */ 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x18, 0x18, 0x00,
+ /* ¦ */ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
+ /* § */ 0x3c, 0x60, 0x3c, 0x66, 0x3c, 0x06, 0x3c, 0x00,
+ /* ¨ */ 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* © */ 0x7e, 0x81, 0x9d, 0xb1, 0x9d, 0x81, 0x7e, 0x00,
+ /* ª */ 0x1c, 0x24, 0x44, 0x3c, 0x00, 0x7e, 0x00, 0x00,
+ /* « */ 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00,
+ /* ¬ */ 0x3e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* */ 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
+ /* ® */ 0x7e, 0x81, 0xb9, 0xa5, 0xb9, 0xa5, 0x81, 0x7e,
+ /* ¯ */ 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* ° */ 0x3c, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* ± */ 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00,
+ /* ² */ 0x78, 0x0c, 0x18, 0x30, 0x7c, 0x00, 0x00, 0x00,
+ /* ³ */ 0x78, 0x0c, 0x18, 0x0c, 0x78, 0x00, 0x00, 0x00,
+ /* ´ */ 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+ /* µ */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7f, 0x60,
+ /* ¶ */ 0x3e, 0x7a, 0x7a, 0x3a, 0x0a, 0x0a, 0x0a, 0x00,
+ /* · */ 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
+ /* ¸ */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30,
+ /* ¹ */ 0x30, 0x70, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00,
+ /* º */ 0x38, 0x44, 0x44, 0x38, 0x00, 0x7c, 0x00, 0x00,
+ /* » */ 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00,
+ /* ¼ */ 0x40, 0xc6, 0x4c, 0x58, 0x32, 0x66, 0xcf, 0x02,
+ /* ½ */ 0x40, 0xc6, 0x4c, 0x58, 0x3e, 0x62, 0xc4, 0x0e,
+ /* ¾ */ 0xc0, 0x23, 0x66, 0x2c, 0xd9, 0x33, 0x67, 0x01,
+ /* ¿ */ 0x18, 0x00, 0x18, 0x30, 0x60, 0x66, 0x3c, 0x00,
+ /* À */ 0x30, 0x18, 0x3c, 0x66, 0x7e, 0x66, 0x66, 0x00,
+ /* Á */ 0x0c, 0x18, 0x3c, 0x66, 0x7e, 0x66, 0x66, 0x00,
+ /* Â */ 0x18, 0x66, 0x3c, 0x66, 0x7e, 0x66, 0x66, 0x00,
+ /* Ã */ 0x71, 0x8e, 0x3c, 0x66, 0x7e, 0x66, 0x66, 0x00,
+ /* Ä */ 0x66, 0x00, 0x3c, 0x66, 0x7e, 0x66, 0x66, 0x00,
+ /* Å */ 0x18, 0x24, 0x3c, 0x66, 0x7e, 0x66, 0x66, 0x00,
+ /* Æ */ 0x1f, 0x3c, 0x3c, 0x6f, 0x7c, 0xcc, 0xcf, 0x00,
+ /* Ç */ 0x1e, 0x30, 0x60, 0x60, 0x30, 0x1e, 0x0c, 0x18,
+ /* È */ 0x30, 0x18, 0x7e, 0x60, 0x78, 0x60, 0x7e, 0x00,
+ /* É */ 0x0c, 0x18, 0x7e, 0x60, 0x78, 0x60, 0x7e, 0x00,
+ /* Ê */ 0x18, 0x66, 0x7e, 0x60, 0x78, 0x60, 0x7e, 0x00,
+ /* Ë */ 0x66, 0x00, 0x7e, 0x60, 0x78, 0x60, 0x7e, 0x00,
+ /* Ì */ 0x30, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00,
+ /* Í */ 0x0c, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00,
+ /* Î */ 0x18, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00,
+ /* Ï */ 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00,
+ /* Ð */ 0x78, 0x6c, 0x66, 0xf6, 0x66, 0x6c, 0x78, 0x00,
+ /* Ñ */ 0x71, 0xce, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0x00,
+ /* Ò */ 0x30, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* Ó */ 0x0c, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* Ô */ 0x18, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* Õ */ 0x71, 0x8e, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* Ö */ 0xc3, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* × */ 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00, 0x00,
+ /* Ø */ 0x3f, 0x66, 0x6e, 0x7e, 0x76, 0x66, 0xfc, 0x00,
+ /* Ù */ 0x30, 0x18, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* Ú */ 0x0c, 0x18, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* Û */ 0x18, 0x24, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* Ü */ 0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
+ /* Ý */ 0x06, 0x08, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x00,
+ /* Þ */ 0xc0, 0xc0, 0xfc, 0xc6, 0xfc, 0xc0, 0xc0, 0x00,
+ /* ß */ 0x3c, 0x66, 0x66, 0x6c, 0x66, 0x66, 0x6c, 0x60,
+ /* à */ 0x30, 0x18, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
+ /* á */ 0x0c, 0x18, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
+ /* â */ 0x18, 0x66, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
+ /* ã */ 0x71, 0x8e, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
+ /* ä */ 0x66, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
+ /* å */ 0x18, 0x24, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00,
+ /* æ */ 0x00, 0x00, 0x7e, 0x1b, 0x7f, 0xd8, 0x77, 0x00,
+ /* ç */ 0x00, 0x00, 0x3c, 0x60, 0x60, 0x60, 0x3c, 0x18,
+ /* è */ 0x30, 0x18, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
+ /* é */ 0x0c, 0x18, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
+ /* ê */ 0x18, 0x66, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
+ /* ë */ 0x66, 0x00, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
+ /* ì */ 0x30, 0x18, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x00,
+ /* í */ 0x0c, 0x18, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x00,
+ /* î */ 0x18, 0x66, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x00,
+ /* ï */ 0x00, 0x66, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x00,
+ /* ð */ 0x60, 0xfc, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x00,
+ /* ñ */ 0x71, 0x8e, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x00,
+ /* ò */ 0x30, 0x18, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x00,
+ /* ó */ 0x0c, 0x18, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x00,
+ /* ô */ 0x18, 0x66, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x00,
+ /* õ */ 0x71, 0x8e, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x00,
+ /* ö */ 0x00, 0x66, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x00,
+ /* ÷ */ 0x00, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x00, 0x00,
+ /* ø */ 0x00, 0x02, 0x7c, 0xce, 0xd6, 0xe6, 0x7c, 0x80,
+ /* ù */ 0x30, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x00,
+ /* ú */ 0x0c, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x00,
+ /* û */ 0x18, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x00,
+ /* ü */ 0x00, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x00,
+ /* ý */ 0x0c, 0x18, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x30,
+ /* þ */ 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60,
+ /* ÿ */ 0x00, 0x66, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x30,
+ };
*** old-NetBSD/src/sys/arch/amiga/dev/mfc.c
--- NetBSD/src/sys/arch/amiga/dev/mfc.c
***************
*** 359,364 ****
--- 359,365 ----
scc->sc_isr.isr_intr = mfcintr;
scc->sc_isr.isr_arg = scc;
scc->sc_isr.isr_ipl = 6;
+ scc->sc_isr.isr_mapped_ipl = 3;
add_isr(&scc->sc_isr);
/* configure ports */
***************
*** 408,414 ****
if (dp) {
printf (": input fifo %d output fifo %d\n", SERIBUF_SIZE,
SEROBUF_SIZE);
- alloc_sicallback();
}
unit = ma->unit;
--- 409,414 ----
***************
*** 988,997 ****
tp->t_state &= ~(TS_BUSY | TS_FLUSH);
scc->imask &= ~0x01;
regs->du_imr = scc->imask;
! add_sicallback (tp->t_line ?
! linesw[tp->t_line].l_start : mfcsstart,
! tp, NULL);
!
}
else
regs->du_tba = *sc->ptr++;
--- 988,997 ----
tp->t_state &= ~(TS_BUSY | TS_FLUSH);
scc->imask &= ~0x01;
regs->du_imr = scc->imask;
! if (tp->t_line)
! (*linesw[tp->t_line].l_start)(tp);
! else
! mfcsstart(tp);
}
else
regs->du_tba = *sc->ptr++;
***************
*** 1003,1011 ****
tp->t_state &= ~(TS_BUSY | TS_FLUSH);
scc->imask &= ~0x10;
regs->du_imr = scc->imask;
! add_sicallback (tp->t_line ?
! linesw[tp->t_line].l_start : mfcsstart,
! tp, NULL);
}
else
regs->du_tbb = *sc->ptr++;
--- 1003,1012 ----
tp->t_state &= ~(TS_BUSY | TS_FLUSH);
scc->imask &= ~0x10;
regs->du_imr = scc->imask;
! if (tp->t_line)
! (*linesw[tp->t_line].l_start)(tp);
! else
! mfcsstart(tp);
}
else
regs->du_tbb = *sc->ptr++;
*** old-NetBSD/src/sys/arch/amiga/dev/ms.c
--- NetBSD/src/sys/arch/amiga/dev/ms.c
***************
*** 179,184 ****
--- 179,188 ----
pra >>= unit == 0 ? 6 : 7; /* contains left button */
mb = (pot & 4) / 4 + (pot & 1) * 2 + (pra & 1) * 4;
mb ^= 0x07;
+ #ifdef EMULATE_3_BUTTONS
+ if (mb == 5)
+ mb = 2;
+ #endif
/*
* read current values of counter registers
*** old-NetBSD/src/sys/arch/amiga/dev/par.c
--- NetBSD/src/sys/arch/amiga/dev/par.c
***************
*** 54,59 ****
--- 54,61 ----
#include <amiga/amiga/cia.h>
#include <amiga/dev/parioctl.h>
+ /* this used to be in systm.h */
+ typedef void (*timeout_t) __P((void *));
struct par_softc {
int sc_flags;
***************
*** 61,66 ****
--- 63,70 ----
#define sc_burst sc_param.burst
#define sc_timo sc_param.timo
#define sc_delay sc_param.delay
+ u_char *sc_buf;
+ u_int sc_buflen;
} *par_softcp;
#define getparsp(x) (x > 0 ? NULL : par_softcp)
***************
*** 153,158 ****
--- 157,166 ----
sc->sc_burst = PAR_BURST;
sc->sc_timo = parmstohz(PAR_TIMO);
sc->sc_delay = parmstohz(PAR_DELAY);
+
+ sc->sc_buf = (u_char*) malloc (sc->sc_burst, M_DEVBUF, M_WAITOK);
+ sc->sc_buflen = sc->sc_burst;
+
/* enable interrupts for CIAA-FLG */
ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_FLG;
return(0);
***************
*** 170,175 ****
--- 178,188 ----
dev, flags, sc->sc_flags);
#endif
sc->sc_flags &= ~(PARF_OPEN|PARF_OREAD|PARF_OWRITE);
+
+ free(sc->sc_buf, M_DEVBUF);
+ sc->sc_buf = 0;
+ sc->sc_buflen = 0;
+
/* don't allow interrupts for CIAA-FLG any longer */
ciaa.icr = CIA_ICR_FLG;
return(0);
***************
*** 258,269 ****
sc->sc_burst, sc->sc_timo, uio->uio_resid);
#endif
buflen = min(sc->sc_burst, uio->uio_resid);
! buf = (char *)malloc(buflen, M_DEVBUF, M_WAITOK);
sc->sc_flags |= PARF_UIO;
if (sc->sc_timo > 0)
{
sc->sc_flags |= PARF_TIMO;
! timeout(partimo, (void *)unit, sc->sc_timo);
}
while (uio->uio_resid > 0)
{
--- 271,282 ----
sc->sc_burst, sc->sc_timo, uio->uio_resid);
#endif
buflen = min(sc->sc_burst, uio->uio_resid);
! buf = sc->sc_buf;
sc->sc_flags |= PARF_UIO;
if (sc->sc_timo > 0)
{
sc->sc_flags |= PARF_TIMO;
! timeout((timeout_t) partimo, (void *) unit, sc->sc_timo);
}
while (uio->uio_resid > 0)
{
***************
*** 276,290 ****
break;
}
again:
- s = splbio();
- #if 0
- if ((sc->sc_flags & PARF_UIO) && hpibreq(&sc->sc_dq) == 0)
- sleep(sc, PRIBIO+1);
- #endif
/*
! * Check if we timed out during sleep or uiomove
*/
! (void) splsoftclock();
if ((sc->sc_flags & PARF_UIO) == 0)
{
#ifdef DEBUG
--- 289,298 ----
break;
}
again:
/*
! * Check if we timed out during uiomove
*/
! s = splsoftclock();
if ((sc->sc_flags & PARF_UIO) == 0)
{
#ifdef DEBUG
***************
*** 294,300 ****
#endif
if (sc->sc_flags & PARF_TIMO)
{
! untimeout(partimo, (void *)unit);
sc->sc_flags &= ~PARF_TIMO;
}
splx(s);
--- 302,308 ----
#endif
if (sc->sc_flags & PARF_TIMO)
{
! untimeout((timeout_t) partimo, (void *) unit);
sc->sc_flags &= ~PARF_TIMO;
}
splx(s);
***************
*** 316,324 ****
}
s = splbio();
- #if 0
- hpibfree(&sc->sc_dq);
- #endif
#ifdef DEBUG
if (pardebug & PDB_IO)
printf("parrw: %s(%x, %d) -> %d\n",
--- 324,329 ----
***************
*** 357,367 ****
/*
* Implement inter-read delay
*/
! if (sc->sc_delay > 0)
{
sc->sc_flags |= PARF_DELAY;
! timeout(parstart, (void *)unit, sc->sc_delay);
! error = tsleep(sc, PCATCH|PZERO-1, "par-cdelay", 0);
if (error)
{
splx(s);
--- 362,372 ----
/*
* Implement inter-read delay
*/
! if (uio->uio_rw == UIO_READ && sc->sc_delay > 0)
{
sc->sc_flags |= PARF_DELAY;
! timeout((timeout_t) parstart, (void *) unit, sc->sc_delay);
! error = tsleep((caddr_t) sc, PCATCH|PZERO-1, "par-cdelay", 0);
if (error)
{
splx(s);
***************
*** 384,395 ****
s = splsoftclock();
if (sc->sc_flags & PARF_TIMO)
{
! untimeout(partimo, (void *)unit);
sc->sc_flags &= ~PARF_TIMO;
}
if (sc->sc_flags & PARF_DELAY)
{
! untimeout(parstart, (void *)unit);
sc->sc_flags &= ~PARF_DELAY;
}
splx(s);
--- 389,400 ----
s = splsoftclock();
if (sc->sc_flags & PARF_TIMO)
{
! untimeout((timeout_t) partimo, (void *) unit);
sc->sc_flags &= ~PARF_TIMO;
}
if (sc->sc_flags & PARF_DELAY)
{
! untimeout((timeout_t) parstart, (void *) unit);
sc->sc_flags &= ~PARF_DELAY;
}
splx(s);
***************
*** 405,411 ****
len-cnt);
#endif
}
- free(buf, M_DEVBUF);
#ifdef DEBUG
if (pardebug & (PDB_FOLLOW|PDB_IO))
printf("parrw: return %d, resid %d\n", error, uio->uio_resid);
--- 410,415 ----
***************
*** 444,449 ****
--- 448,459 ----
pp->burst = upp->burst;
pp->timo = parmstohz(upp->timo);
pp->delay = parmstohz(upp->delay);
+ if (pp->burst > sc->sc_buflen)
+ {
+ free (sc->sc_buf, M_DEVBUF);
+ sc->sc_buf = (u_char *) malloc (sc->sc_burst, M_DEVBUF, M_WAITOK);
+ sc->sc_buflen = sc->sc_burst;
+ }
break;
default:
***************
*** 479,489 ****
return(h);
}
! /* stuff below here if for interrupt driven output of data thru
the parallel port. */
int partimeout_pending;
int parsend_pending;
void
parintr(arg)
--- 489,500 ----
return(h);
}
! /* stuff below here is for interrupt driven output of data thru
the parallel port. */
int partimeout_pending;
int parsend_pending;
+ u_char *parbp;
void
parintr(arg)
***************
*** 498,581 ****
if (pardebug & PDB_INTERRUPT)
printf("parintr %s\n", mask ? "FLG" : "tout");
#endif
! /*
! * if invoked from timeout handler, mask will be 0,
! * if from interrupt, it will contain the cia-icr mask,
! * which is != 0
! */
! if (mask) {
! if (partimeout_pending)
! untimeout(parintr, 0);
! if (parsend_pending)
! parsend_pending = 0;
! }
!
! /* either way, there won't be a timeout pending any longer */
partimeout_pending = 0;
!
! wakeup(parintr);
! splx(s);
}
int
! parsendch (ch)
! u_char ch;
{
! int error = 0;
! int s;
!
! /* if either offline, busy or out of paper, wait for that
! condition to clear */
! s = splclock();
! while (!error
! && (parsend_pending
! || ((ciab.pra ^ CIAB_PRA_SEL)
! & (CIAB_PRA_SEL|CIAB_PRA_BUSY|CIAB_PRA_POUT))))
! {
! extern int hz;
! #ifdef DEBUG
! if (pardebug & PDB_INTERRUPT)
! printf ("parsendch, port = $%x\n",
! ((ciab.pra ^ CIAB_PRA_SEL)
! & (CIAB_PRA_SEL|CIAB_PRA_BUSY|CIAB_PRA_POUT)));
! #endif
! /* wait a second, and try again */
! timeout(parintr, 0, hz);
! partimeout_pending = 1;
! /* this is essentially a flipflop to have us wait for the
! first character being transmitted when trying to transmit
! the second, etc. */
! parsend_pending = 0;
! /* it's quite important that a parallel putc can be
! interrupted, given the possibility to lock a printer
! in an offline condition.. */
! if (error = tsleep(parintr, PCATCH|PZERO-1, "parsendch", 0))
! {
! #ifdef DEBUG
! if (pardebug & PDB_INTERRUPT)
! printf ("parsendch interrupted, error = %d\n", error);
! #endif
! if (partimeout_pending)
! untimeout(parintr, 0);
!
! partimeout_pending = 0;
! }
! }
!
! if (! error)
! {
! #ifdef DEBUG
! if (pardebug & PDB_INTERRUPT)
! printf ("#%d", ch);
! #endif
! ciaa.prb = ch;
! parsend_pending = 1;
! }
!
! splx (s);
- return error;
}
--- 509,545 ----
if (pardebug & PDB_INTERRUPT)
printf("parintr %s\n", mask ? "FLG" : "tout");
#endif
! if (partimeout_pending)
! untimeout ((timeout_t) parintr, 0);
partimeout_pending = 0;
! splx (s);
!
! parsendch ();
}
int
! parsendch ()
{
! int s;
! s = splclock();
! /* if port is offline, wait a second, and fake a new interrupt, which
! * will take us here again. */
! if (((ciab.pra ^ CIAB_PRA_SEL)
! & (CIAB_PRA_SEL|CIAB_PRA_BUSY|CIAB_PRA_POUT))) {
! extern int hz;
! timeout ((timeout_t) parintr, 0, hz);
! partimeout_pending = 1;
! } else if (parsend_pending > 0) {
! /* transmit next character */
! ciaa.prb = *parbp++;
! parsend_pending--;
! } else {
! /* no more characters to transmit, wake up parsend() */
! wakeup ((caddr_t) parintr);
! }
! splx (s);
}
***************
*** 584,604 ****
u_char *buf;
int len;
{
! int err, orig_len = len;
! /* make sure I/O lines are setup right for output */
- /* control lines set to input */
- ciab.ddra &= ~(CIAB_PRA_SEL|CIAB_PRA_POUT|CIAB_PRA_BUSY);
- /* data lines to output */
- ciaa.ddrb = 0xff;
-
- for (; len; len--, buf++)
- if (err = parsendch (*buf))
- return err < 0 ? -EINTR : -err;
-
- /* either all or nothing.. */
- return orig_len;
}
--- 548,584 ----
u_char *buf;
int len;
{
! int err, s;
! /* guess that can't happen, right? */
! if (len <= 0)
! return -EINVAL;
!
! /* make sure I/O lines are setup right for output */
!
! /* control lines set to input */
! ciab.ddra &= ~(CIAB_PRA_SEL|CIAB_PRA_POUT|CIAB_PRA_BUSY);
! /* data lines to output */
! ciaa.ddrb = 0xff;
!
! s = spltty();
!
! /* pass buffer information to interrupt handler */
! parbp = buf;
! parsend_pending = len;
! /* send first character */
! parsendch();
! err = tsleep ((caddr_t) parintr, PCATCH|PZERO-1, "parsend", 0);
! len -= parsend_pending;
! parsend_pending = 0;
! if (partimeout_pending)
! untimeout ((timeout_t) parintr, 0);
!
! splx (s);
! if (err)
! return err < 0 ? -EINTR : -err;
! return len;
}
***************
*** 608,616 ****
u_char *buf;
int len;
{
! /* oh deary me, something's gotta be left to be implemented
! later... */
! return 0;
}
--- 588,598 ----
u_char *buf;
int len;
{
!
! /* oh deary me, something's gotta be left to be implemented
! * later... */
! return 0;
!
}
*** old-NetBSD/src/sys/arch/amiga/dev/sbic.c
--- NetBSD/src/sys/arch/amiga/dev/sbic.c
***************
*** 43,48 ****
--- 43,57 ----
* AMIGA AMD 33C93 scsi adaptor driver
*/
+ /*
+ * Count the number of controllers using this driver, we need to build
+ * a sync enable array large enough for all of them.
+ */
+ #include "ahsc.h"
+ #include "atzsc.h"
+ #include "gtsc.h"
+ #define NSBIC (NAHSC + NATZSC + NGTSC)
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
***************
*** 121,131 ****
int sbic_data_wait = SBIC_DATA_WAIT;
int sbic_init_wait = SBIC_INIT_WAIT;
/*
! * was broken before.. now if you want this you get it for all drives
! * on sbic controllers.
*/
! int sbic_inhibit_sync = 0;
int sbic_enable_reselect = 1;
int sbic_clock_override = 0;
int sbic_no_dma = 0;
--- 130,141 ----
int sbic_data_wait = SBIC_DATA_WAIT;
int sbic_init_wait = SBIC_INIT_WAIT;
+ int sbic_cnt = 0;
/*
! * Another try on individual sync setting. Trust uninitialized data
! * is zero on startup.
*/
! char sbic_inhibit_sync[NSBIC * 8] = { 0 };
int sbic_enable_reselect = 1;
int sbic_clock_override = 0;
int sbic_no_dma = 0;
***************
*** 137,143 ****
int sbicdma_bounces = 0; /* number operations using bounce buffer */
int sbicdma_hits = 0; /* number of DMA chains that were contiguous */
int sbicdma_misses = 0; /* number of DMA chains that were not contiguous */
! int sbicdma_saves = 0;
#define QPRINTF(a) if (sbic_debug > 1) printf a
int sbic_debug = 0;
int sync_debug = 0;
--- 147,153 ----
int sbicdma_bounces = 0; /* number operations using bounce buffer */
int sbicdma_hits = 0; /* number of DMA chains that were contiguous */
int sbicdma_misses = 0; /* number of DMA chains that were not contiguous */
! int sbicdma_saves = 0;
#define QPRINTF(a) if (sbic_debug > 1) printf a
int sbic_debug = 0;
int sync_debug = 0;
***************
*** 1027,1033 ****
* handle drives that don't want to be asked
* whether to go sync at all.
*/
! if (sbic_inhibit_sync && dev->sc_sync[id].state == SYNC_START) {
#ifdef DEBUG
if (sync_debug)
printf("Forcing target %d asynchronous.\n", id);
--- 1037,1044 ----
* handle drives that don't want to be asked
* whether to go sync at all.
*/
! if (sbic_inhibit_sync[id + dev->sc_no]
! && dev->sc_sync[id].state == SYNC_START) {
#ifdef DEBUG
if (sync_debug)
printf("Forcing target %d asynchronous.\n", id);
*** old-NetBSD/src/sys/arch/amiga/dev/sbicvar.h
--- NetBSD/src/sys/arch/amiga/dev/sbicvar.h
***************
*** 142,147 ****
--- 142,148 ----
void (*sc_dmafree) __P((struct sbic_softc *));
void (*sc_dmastop) __P((struct sbic_softc *));
u_short gtsc_bankmask; /* GVP specific bank selected */
+ int sc_no;
};
/* sc_flags */
***************
*** 162,168 ****
#define DDB_FOLLOW 0x04
#define DDB_IO 0x08
#endif
! extern int sbic_inhibit_sync;
extern int sbic_no_dma;
extern int sbic_clock_override;
--- 163,170 ----
#define DDB_FOLLOW 0x04
#define DDB_IO 0x08
#endif
! extern int sbic_cnt;
! extern char sbic_inhibit_sync[];
extern int sbic_no_dma;
extern int sbic_clock_override;
*** old-NetBSD/src/sys/arch/amiga/dev/ser.c
--- NetBSD/src/sys/arch/amiga/dev/ser.c
***************
*** 35,41 ****
* @(#)ser.c 7.12 (Berkeley) 6/27/91
*/
/*
! * XXX This file needs major cleanup it will never ervice more than one
* XXX unit.
*/
--- 35,41 ----
* @(#)ser.c 7.12 (Berkeley) 6/27/91
*/
/*
! * XXX This file needs major cleanup it will never service more than one
* XXX unit.
*/
***************
*** 75,81 ****
#define SEROBUF_SIZE 32
#endif
#ifndef SERIBUF_SIZE
! #define SERIBUF_SIZE 512
#endif
#define splser() spl5()
--- 75,81 ----
#define SEROBUF_SIZE 32
#endif
#ifndef SERIBUF_SIZE
! #define SERIBUF_SIZE 16738
#endif
#define splser() spl5()
***************
*** 310,321 ****
}
}
done:
- /* This is a way to handle lost XON characters */
- if ((flag & O_TRUNC) && (tp->t_state & TS_TTSTOP)) {
- tp->t_state &= ~TS_TTSTOP;
- ttstart (tp);
- }
-
splx(s);
/*
* Reset the tty pointer, as there could have been a dialout
--- 310,315 ----
***************
*** 725,731 ****
return(0);
}
! int serhwiflow(tp, flag)
struct tty *tp;
int flag;
{
--- 719,726 ----
return(0);
}
! int
! serhwiflow(tp, flag)
struct tty *tp;
int flag;
{
***************
*** 1049,1055 ****
short stat;
int s;
! s = splhigh();
if (serconsinit == 0) {
(void)serinit(SERUNIT(dev), serdefaultrate);
--- 1044,1050 ----
short stat;
int s;
! s = splser();
if (serconsinit == 0) {
(void)serinit(SERUNIT(dev), serdefaultrate);
*** old-NetBSD/src/sys/arch/amiga/dev/zbus.c
--- NetBSD/src/sys/arch/amiga/dev/zbus.c
***************
*** 110,115 ****
--- 110,116 ----
{ "grfcl", 2193, 1}, /* Spectrum regs */
{ "grfcl", 2195, 5}, /* Piccolo mem */
{ "grfcl", 2195, 6}, /* Piccolo regs */
+
/* MacroSystemsUS */
{ "wesc", 2203, 19}, /* Warp engine */
/* phase 5 digital products? */
***************
*** 118,133 ****
/* Commodore Amiga */
{ "afsc", 514, 84}, /* A4091 SCSI HD Controller */
/* Hacker Inc. */
! { "mlhsc", 2011, 1 }
};
static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata);
/*
* Anything listed in this table is subject to pre-configuration,
* if autoconf.c:config_console() calls amiga_config_found() on
! * the Zorro III device.
*/
static struct preconfdata preconftab[] = {
{ 18260, 6, 0 },
/* Retina BLT Z3 */
{ 18260, 16, 0},
--- 119,138 ----
/* Commodore Amiga */
{ "afsc", 514, 84}, /* A4091 SCSI HD Controller */
/* Hacker Inc. */
! { "mlhsc", 2011, 1 }, /* Michael Hitch */
! { "cross", 2011, 3 }, /* Mark Tomlinsen */
! /* David Salamon */
! { "ggbus", 2150, 1 }
};
static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata);
/*
* Anything listed in this table is subject to pre-configuration,
* if autoconf.c:config_console() calls amiga_config_found() on
! * the zbus device.
*/
static struct preconfdata preconftab[] = {
+ /* Retina BLT Z2 */
{ 18260, 6, 0 },
/* Retina BLT Z3 */
{ 18260, 16, 0},
*** old-NetBSD/src/sys/arch/amiga/dev/zssc.c
--- NetBSD/src/sys/arch/amiga/dev/zssc.c
***************
*** 79,85 ****
DV_DULL, sizeof(struct siop_softc), NULL, 0 };
/*
! * if we are an PPI Zeus
*/
int
zsscmatch(pdp, cdp, auxp)
--- 79,85 ----
DV_DULL, sizeof(struct siop_softc), NULL, 0 };
/*
! * if we are a PPI Zeus
*/
int
zsscmatch(pdp, cdp, auxp)
***************
*** 130,135 ****
--- 130,136 ----
sc->sc_isr.isr_intr = zssc_dmaintr;
sc->sc_isr.isr_arg = sc;
sc->sc_isr.isr_ipl = 6;
+ sc->sc_isr.isr_mapped_ipl = 3;
add_isr(&sc->sc_isr);
/*
*** old-NetBSD/src/sys/arch/amiga/include/mtpr.h
--- NetBSD/src/sys/arch/amiga/include/mtpr.h
***************
*** 41,48 ****
*
* @(#)mtpr.h 7.2 (Berkeley) 11/3/90
*/
! #ifndef _MACHINE_MPTR_H_
! #define _MACHINE_MPTR_H_
#ifdef _KERNEL
/*
--- 41,48 ----
*
* @(#)mtpr.h 7.2 (Berkeley) 11/3/90
*/
! #ifndef _MACHINE_MTPR_H_
! #define _MACHINE_MTPR_H_
#ifdef _KERNEL
/*
***************
*** 60,66 ****
#define SIR_NET 0x1 /* call netintr */
#define SIR_CLOCK 0x2 /* call softclock */
! #define SIR_CBACK 0x4 /* walk the sicallback-chain */
#define siroff(x) ssir &= ~(x)
#define setsoftint() (custom.intreq = INTF_SETCLR|INTF_SOFTINT)
--- 60,66 ----
#define SIR_NET 0x1 /* call netintr */
#define SIR_CLOCK 0x2 /* call softclock */
! #define SIR_CBACK 0x4 /* walk the sicallback-chain */
#define siroff(x) ssir &= ~(x)
#define setsoftint() (custom.intreq = INTF_SETCLR|INTF_SOFTINT)
***************
*** 68,74 ****
#define setsoftnet() (ssir |= SIR_NET, setsoftint())
#define setsoftclock() (ssir |= SIR_CLOCK, setsoftint())
#define setsoftcback() (ssir |= SIR_CBACK, setsoftint())
-
#endif /* _KERNEL */
! #endif /* !_MACHINE_MPTR_H_ */
--- 68,73 ----
#define setsoftnet() (ssir |= SIR_NET, setsoftint())
#define setsoftclock() (ssir |= SIR_CLOCK, setsoftint())
#define setsoftcback() (ssir |= SIR_CBACK, setsoftint())
#endif /* _KERNEL */
! #endif /* !_MACHINE_MTPR_H_ */
*** old-NetBSD/src/sys/arch/amiga/include/param.h
--- NetBSD/src/sys/arch/amiga/include/param.h
***************
*** 149,200 ****
*/
#include <machine/psl.h>
! /*
! * point to the custom.intenar and custom.intenaw respectively.
! */
! extern volatile unsigned short *amiga_intena_read, *amiga_intena_write;
! #if 0
! #define _debug_spl(s) \
({ \
register int _spl_r; \
\
! __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
! "&=d" (_spl_r) : "di" (s)); \
! if ((_spl_r&PSL_IPL) > ((s)&PSL_IPL)&&((s)&PSL_IPL)!=PSL_IPL1) \
! printf ("%s:%d:spl(%d) ==> spl(%d)!!\n",__FILE__,__LINE__, \
! ((PSL_IPL&_spl_r)>>8), ((PSL_IPL&(s))>>8)); \
_spl_r; \
})
! #else
! /*
! * Don't lower IPL below current IPL (unless new IPL is 6)
! */
! #define _debug_spl(s) \
({ \
register int _spl_r; \
\
! __asm __volatile ("clrl %0; movew sr,%0" : \
! "&=d" (_spl_r)); \
! if ((((s)&PSL_IPL) >= PSL_IPL6) || (_spl_r&PSL_IPL) < ((s)&PSL_IPL) || ((s)&PSL_IPL) <= PSL_IPL1) \
! __asm __volatile ("movew %0,sr" : : "di" (s)); \
_spl_r; \
})
#endif
#define _spl_no_check(s) \
({ \
register int _spl_r; \
\
! __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
! "&=d" (_spl_r) : "di" (s)); \
! _spl_r; \
})
! #if defined (DEBUGXX) /* No workee */
! #define _spl _debug_spl
! #else
! #define _spl _spl_no_check
! #endif
#define spl0() _spl(PSL_S|PSL_IPL0)
#define spl1() _spl(PSL_S|PSL_IPL1)
--- 149,241 ----
*/
#include <machine/psl.h>
! #ifdef SPL_PROF
! struct _spl_ent {
! int psw;
! int ticks;
! int usec;
! };
!
! #define _spl_push(s) \
({ \
register int _spl_r; \
\
! __asm __volatile("clrl %0; movew sr,%0" : "=d" (_spl_r)); \
! if (spl_prof || spl_debug) { \
! if (spl_debug && (_spl_r & PSL_IPL) > (s & PSL_IPL)) \
! printf ("%s:%d: unexpected lowering of spl" \
! " 0x%x to 0x%x\n", \
! __FILE__, __LINE__, _spl_r, s); \
! _spl_p->psw = _spl_r; \
! if (spl_prof) { \
! _spl_p->ticks = ticks; \
! _spl_p->usec = clkread(); \
! } \
! _spl_p++; \
! } \
! if ((isr_exter_ipl << 8) > (s & PSL_IPL)) \
! walk_ipls(isr_exter_ipl, s); \
! __asm __volatile("movew %0,sr" : : "di" (s)); \
_spl_r; \
})
!
! #define _spl_pop(s) \
({ \
+ u_int elapsed; \
register int _spl_r; \
\
! __asm __volatile("clrl %0; movew sr,%0" : "=d" (_spl_r)); \
! if ((spl_prof || spl_debug) && _spl_p > _spl_stack) { \
! _spl_p--; \
! if (_spl_p->psw != s) { \
! if (spl_debug) \
! printf ("%s:%d: unexpected spl 0x%x " \
! "(wanted 0x%x)\n", \
! __FILE__, __LINE__, s, _spl_p->psw); \
! _spl_p++; \
! } else if (spl_prof) { \
! elapsed = 10000 * (ticks - _spl_p->ticks) + \
! clkread() - _spl_p->usec; \
! if (elapsed > 100) \
! printf ( \
! "%s:%d: long spl (%d us) above 0x%x\n", \
! __FILE__, __LINE__, elapsed, s); \
! } \
! } \
! if ((isr_exter_ipl << 8) > (s & PSL_IPL)) \
! walk_ipls(isr_exter_ipl, s); \
! __asm __volatile("movew %0,sr" : : "di" (s)); \
_spl_r; \
})
+
+ #define _spl _spl_push
+ #define splx _spl_pop
+
+ #ifdef _KERNEL
+ extern int ticks;
+ extern int clkread();
+ extern struct _spl_ent _spl_stack[], *_spl_p;
+ extern int spl_debug, spl_prof;
#endif
+ #else /* SPL_PROF */
+
#define _spl_no_check(s) \
({ \
register int _spl_r; \
\
! __asm __volatile("clrl %0; movew sr,%0" : "=d" (_spl_r)); \
! if ((isr_exter_ipl << 8) > (s & PSL_IPL)) \
! walk_ipls(isr_exter_ipl, s); \
! __asm __volatile("movew %0,sr" : : "di" (s)); \
! _spl_r; \
})
!
! #define _spl _spl_no_check
! #define splx _spl_no_check
!
! #endif /* SPL_PROF */
#define spl0() _spl(PSL_S|PSL_IPL0)
#define spl1() _spl(PSL_S|PSL_IPL1)
***************
*** 226,236 ****
#define splsched() spl4()
#endif
- #define splx(s) _spl_no_check(s)
-
#ifdef _KERNEL
void delay __P((int));
void DELAY __P((int));
#endif
#endif /* !_MACHINE_PARAM_H_ */
--- 267,277 ----
#define splsched() spl4()
#endif
#ifdef _KERNEL
void delay __P((int));
void DELAY __P((int));
+ extern int isr_exter_ipl;
+ extern void walk_ipls __P((int, int));
#endif
#endif /* !_MACHINE_PARAM_H_ */
*** old-NetBSD/src/sys/arch/amiga/include/trap.h
--- NetBSD/src/sys/arch/amiga/include/trap.h
***************
*** 1,4 ****
! /* $NetBSD: trap.h,v 1.8 1995/02/12 19:19:39 chopps Exp $ */
#ifndef _MACHINE_TRAP_H_
#define _MACHINE_TRAP_H_
--- 1,4 ----
! /* $NetBSD: trap.h,v 1.7 1994/10/26 02:06:42 cgd Exp $ */
#ifndef _MACHINE_TRAP_H_
#define _MACHINE_TRAP_H_
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/ISA-HOWTO
***************
*** 0 ****
--- 1,29 ----
+ Move i386/isa/foo*.[ch] to amiga/isa possibly prepending 'isa' to the name
+
+ Reflect possible filename change in the source
+
+ Change include of i386/isa/isa_machdep.h to amiga/isa/isa_machdep.h
+
+ Move possible other i386/isa/*.h files that are needed
+
+ If there are inw, outw, insw or outsw think carefully if these are words
+ that should be converted to host order or not. I.e. if you're reading
+ a device register holding a 16-bit flag word, you should convert it, but
+ if you're reading raw data word-wise you should not. The functions to
+ do this are itohs for converting from isa to host order and htois for the
+ other way round.
+
+ Follow up if ia_maddr is used and change loads/stores to the suitable
+ ldb, stb, ldw and stw inlines defined in isabusvar.h. Think about conversion
+ to host order for wordwide accesses. If the driver uses bcopy for moves
+ from/to shared memory then there's two bcopy versions called copy_to_isa
+ and copy_from_isa for you to use instead. These may have problems with
+ alignment if the target & source can reside on differently aligned areas,
+ i.e. target on odd address while source on even. If you find such usages
+ please tell me. bzero of shared memory is called zero_isa. Tell me if you
+ need long versions of the load/store inlines. Note that ia_maddr is a
+ virtual address in the i386 context, but not in our way of seeing it. Thus
+ any kvtop calls can be removed. I usually replace them with a cast to int.
+
+ For those of you writing isa drivers from scratch, look at another isa
+ driver as a template.
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/ISA-TODO
***************
*** 0 ****
--- 1,5 ----
+ LKM versions
+
+ Compile time option for using inline bridge-dependent code
+
+ 1.0 version
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/cross.c
***************
*** 0 ****
--- 1,422 ----
+ /* $NetBSD: cross.c,v 1.0 1994/07/08 23:32:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1994 Niklas Hallqvist, Carsten Hammer
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christian E. Hopps.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #include <sys/param.h>
+ #include <sys/device.h>
+ #include <sys/kernel.h>
+ #include <sys/malloc.h>
+ #include <sys/syslog.h>
+ #include <machine/cpu.h>
+ #include <amiga/amiga/custom.h>
+ #include <amiga/amiga/device.h>
+ #include <amiga/amiga/isr.h>
+ #include <amiga/dev/zbusvar.h>
+ #include <dev/isa/isavar.h>
+ #include <amiga/isa/isa_machdep.h>
+ #include <amiga/isa/crossvar.h>
+ #include <amiga/isa/crossreg.h>
+
+ int crossdebug = 0;
+
+ /* This static is OK because we only allow one ISA bus. */
+ /* static */ struct cross_device *crossp;
+
+ void crossattach __P((struct device *, struct device *, void *));
+ int crossmatch __P((struct device *, void *, void *));
+ int crossprint __P((void *auxp, char *));
+ void crossoutb __P((struct device *, int, u_char));
+ u_char crossinb __P((struct device *, int));
+ void crossoutw __P((struct device *, int, u_short));
+ u_short crossinw __P((struct device *, int));
+ void crossstb __P((struct device *, int, u_char));
+ u_char crossldb __P((struct device *, int));
+ void crossstw __P((struct device *, int, u_short));
+ u_short crossldw __P((struct device *, int));
+ #if 0
+ void crossaddint __P((struct device *, int, int (*)(), void *,int));
+ void crossremint __P((struct device *, int));
+ #else
+ void crossaddint __P((int, int, struct intrhand *));
+ void crossremint __P((int));
+ #endif
+
+ struct cfdriver crosscd = {
+ NULL, "cross", crossmatch, crossattach,
+ DV_DULL, sizeof(struct cross_device), 0
+ };
+
+ int
+ crossmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+ {
+ struct zbus_args *zap = aux;
+
+ /*
+ * Check manufacturer and product id.
+ */
+ if (zap->manid == 2011 && zap->prodid == 3)
+ return(1);
+ return(0);
+ }
+
+ void
+ crossattach(pdp, dp, auxp)
+ struct device *pdp, *dp;
+ void *auxp;
+ {
+ struct zbus_args *zap = auxp;
+ struct cross_device *cdp = (struct cross_device *)dp;
+
+ crossp = cdp;
+ bcopy(zap, &cdp->cd_zargs, sizeof(struct zbus_args));
+ cdp->cd_link.il_dev = dp;
+ cdp->cd_link.il_inb = crossinb;
+ cdp->cd_link.il_outb = crossoutb;
+ cdp->cd_link.il_inw = crossinw;
+ cdp->cd_link.il_outw = crossoutw;
+ cdp->cd_link.il_ldb = crossldb;
+ cdp->cd_link.il_stb = crossstb;
+ cdp->cd_link.il_ldw = crossldw;
+ cdp->cd_link.il_stw = crossstw;
+ cdp->cd_link.il_addint = crossaddint;
+ cdp->cd_link.il_remint = crossremint;
+ cdp->cd_imask = 1 << CROSS_MASTER;
+
+ /* Enable interrupts lazily in crossaddint. */
+ CROSS_ENABLE_INTS(zap->va, 0);
+ /* Default 16 bit tranfer */
+ *(volatile u_short *)(cdp->cd_zargs.va + CROSS_XLP_LATCH) = CROSS_SBHE;
+
+ printf(": pa 0x%08x va 0x%08x size 0x%x\n", zap->pa, zap->va,
+ zap->size);
+
+ #if 0
+ cdp->cd_isr.isr_intr = crossintr6;
+ cdp->cd_isr.isr_ipl = 6;
+ cdp->cd_isr.isr_mapped_ipl = 4;
+ add_isr(&cdp->cd_isr);
+ #endif
+
+ /*
+ * attempt to configure the board.
+ */
+ config_found(dp, &cdp->cd_link, crossprint);
+ }
+
+ int
+ crossprint(auxp, pnp)
+ void *auxp;
+ char *pnp;
+ {
+ if (pnp == NULL)
+ return(QUIET);
+ return(UNCONF);
+ }
+
+ #if 0
+ /* XXX We don't care about the priority yet, although we ought to. */
+ int
+ crossintr6()
+ {
+ struct cross_device *dev = crossp;
+ int ints;
+ int mine = 0;
+ int i;
+ int bit;
+
+ if (!crossp)
+ return 0;
+
+ ints = CROSS_GET_INT_STATUS(dev->cd_zargs.va) & dev->cd_imask;
+ while (ints) {
+ for (i = 0; bit = ffs(ints); ints >>= bit, i++) {
+ i += bit - 1;
+ if (!dev->cd_ifunc[i]) {
+ log(LOG_WARNING,
+ "Huh, cd_ifunc[%d] was zero (ints=0x%04x, mask=0x%04x)\n",
+ i, ints, dev->cd_imask);
+ #ifdef DDB
+ /*
+ * We better try to find out how this
+ * happened
+ */
+ Debugger();
+ #endif
+ } else {
+ (*dev->cd_ifunc[i])(dev->cd_iarg[i]);
+ mine = 1;
+ }
+ }
+ ints = CROSS_GET_INT_STATUS(dev->cd_zargs.va) & dev->cd_imask;
+ }
+ return mine;
+ }
+ #endif
+
+ void
+ crossoutb(dev, ia, b)
+ struct device *dev;
+ int ia;
+ u_char b;
+ {
+ struct cross_device *cd = (struct cross_device *)dev;
+
+ #ifdef DEBUG
+ if (crossdebug)
+ printf("outb 0x%x,0x%x\n", ia, b);
+ #endif
+
+ *(volatile u_char *)(cd->cd_zargs.va + 2 * ia) = b;
+ }
+
+ u_char
+ crossinb(dev, ia)
+ struct device *dev;
+ int ia;
+ {
+ struct cross_device *cd = (struct cross_device *)dev;
+
+ #ifdef DEBUG
+ u_char retval = *(volatile u_char *)(cd->cd_zargs.va + 2 * ia);
+
+ if (crossdebug)
+ printf("inb 0x%x => 0x%x\n", ia, retval);
+ return retval;
+ #else
+ return *(volatile u_char *)(cd->cd_zargs.va + 2 * ia);
+ #endif
+ }
+
+ void
+ crossoutw(dev, ia, w)
+ struct device *dev;
+ int ia;
+ u_short w;
+ {
+ struct cross_device *cd = (struct cross_device *)dev;
+
+ #ifdef DEBUG
+ if (crossdebug)
+ printf("outw 0x%x,0x%x\n", ia, w);
+ #endif
+ *(volatile u_short *)(cd->cd_zargs.va + 2 * ia) = w;
+ }
+
+ u_short
+ crossinw(dev, ia)
+ struct device *dev;
+ int ia;
+ {
+ struct cross_device *cd = (struct cross_device *)dev;
+ u_short retval = *(volatile u_short *)(cd->cd_zargs.va + 2 * ia);
+
+ #ifdef DEBUG
+ if (crossdebug)
+ printf("inw 0x%x => 0x%x\n", ia, retval);
+ #endif
+ return retval;
+ }
+
+ void
+ crossstb(dev, ia, b)
+ struct device *dev;
+ int ia;
+ u_char b;
+ {
+ /* generate A13-A19 for correct page */
+ u_short upper_addressbits = ia >> 13;
+ struct cross_device *cd = (struct cross_device *)dev;
+
+ *(volatile u_short *)(cd->cd_zargs.va + CROSS_XLP_LATCH) =
+ upper_addressbits | CROSS_SBHE;
+ *(volatile u_char *)(cd->cd_zargs.va + CROSS_MEMORY_OFFSET + 2 * ia) =
+ b;
+ }
+
+ u_char
+ crossldb(dev, ia)
+ struct device *dev;
+ int ia;
+ {
+ /* generate A13-A19 for correct page */
+ u_short upper_addressbits = ia >> 13;
+ struct cross_device *cd = (struct cross_device *)dev;
+
+ *(volatile u_short *)(cd->cd_zargs.va + CROSS_XLP_LATCH) =
+ upper_addressbits | CROSS_SBHE;
+ return *(volatile u_char *)(cd->cd_zargs.va + CROSS_MEMORY_OFFSET +
+ 2 * ia);
+ }
+
+ void
+ crossstw(dev, ia, w)
+ struct device *dev;
+ int ia;
+ u_short w;
+ {
+ /* generate A13-A19 for correct page */
+ u_short upper_addressbits = ia >> 13;
+ struct cross_device *cd = (struct cross_device *)dev;
+
+ *(volatile u_short *)(cd->cd_zargs.va + CROSS_XLP_LATCH) =
+ upper_addressbits | CROSS_SBHE;
+ #ifdef DEBUG
+ if (crossdebug)
+ printf("outw 0x%x,0x%x\n", ia, w);
+ #endif
+ *(volatile u_short *)(cd->cd_zargs.va + CROSS_MEMORY_OFFSET + 2 * ia) =
+ w;
+ }
+
+ u_short
+ crossldw(dev, ia)
+ struct device *dev;
+ int ia;
+ {
+ /* generate A13-A19 for correct page */
+ u_short upper_addressbits = ia >> 13;
+ struct cross_device *cd = (struct cross_device *)dev;
+ u_short retval;
+
+ *(volatile u_short *)(cd->cd_zargs.va + CROSS_XLP_LATCH) =
+ upper_addressbits | CROSS_SBHE;
+ retval = *(volatile u_short *)(cd->cd_zargs.va + CROSS_MEMORY_OFFSET +
+ 2 * ia);
+ #ifdef DEBUG
+ if (crossdebug)
+ printf("ldw 0x%x => 0x%x\n", ia, retval);
+ #endif
+ return retval;
+ }
+
+ static cross_int_map[] = {
+ 0, 0, 0, 0, CROSS_IRQ3, CROSS_IRQ4, CROSS_IRQ5, CROSS_IRQ6, CROSS_IRQ7, 0,
+ CROSS_IRQ9, CROSS_IRQ10, CROSS_IRQ11, CROSS_IRQ12, 0, CROSS_IRQ14,
+ CROSS_IRQ15
+ };
+
+ #if 0
+ /* XXX We don't care about the priority yet, although we ought to. */
+ void
+ crossaddint(dev, irq, func, arg, pri)
+ struct device *dev;
+ int irq;
+ int (*func)();
+ void *arg;
+ int pri;
+ {
+ struct cross_device *cd = (struct cross_device *)dev;
+ int s = splhigh();
+ int bit = cross_int_map[irq + 1];
+
+ if (!bit) {
+ log(LOG_WARNING, "Registration of unknown ISA interrupt %d\n",
+ irq);
+ goto out;
+ }
+ if (cd->cd_imask & 1 << bit) {
+ log(LOG_WARNING, "ISA interrupt %d already handled\n", irq);
+ goto out;
+ }
+ cd->cd_imask |= (1 << bit);
+ CROSS_ENABLE_INTS (cd->cd_zargs.va, cd->cd_imask);
+ cd->cd_ifunc[bit] = func;
+ cd->cd_ipri[bit] = pri;
+ cd->cd_iarg[bit] = arg;
+ out:
+ splx(s);
+ }
+
+ void
+ crossremint(dev, irq)
+ struct device *dev;
+ int irq;
+ {
+ struct cross_device *cd = (struct cross_device *)dev;
+ int s = splhigh();
+ int bit = cross_int_map[irq + 1];
+
+ cd->cd_imask &= ~(1 << bit);
+ CROSS_ENABLE_INTS (cd->cd_zargs.va, cd->cd_imask);
+ splx(s);
+ }
+ #else
+ struct crossintr_desc {
+ struct isr cid_isr;
+ int cid_mask;
+ struct intrhand *cid_ih;
+ };
+
+ static struct crossintr_desc *crid[16]; /* XXX */
+
+ int
+ crossintr(cid)
+ struct crossintr_desc *cid;
+ {
+ return (CROSS_GET_STATUS (crossp->cd_zargs.va) & cid->cid_mask) ?
+ (*cid->cid_ih->ih_fun)(cid->cid_ih->ih_arg) : 0;
+ }
+
+ void
+ crossaddint(irq, type, ih)
+ int irq;
+ int type;
+ struct intrhand *ih;
+ {
+ if (crid[irq]) {
+ log(LOG_WARNING, "ISA interrupt %d already handled\n", irq);
+ return;
+ }
+ MALLOC(crid[irq], struct crossintr_desc *,
+ sizeof(struct crossintr_desc), M_DEVBUF, M_WAITOK);
+ crid[irq]->cid_isr.isr_intr = crossintr;
+ crid[irq]->cid_isr.isr_arg = crid[irq];
+ crid[irq]->cid_isr.isr_ipl = 6;
+ crid[irq]->cid_isr.isr_mapped_ipl = ih->ih_level;
+ crid[irq]->cid_mask = 1 << cross_int_map[irq + 1];
+ crid[irq]->cid_ih = ih;
+ add_isr (&crid[irq]->cid_isr);
+ crossp->cd_imask |= 1 << cross_int_map[irq + 1];
+ CROSS_ENABLE_INTS (crossp->cd_zargs.va, crossp->cd_imask);
+ }
+
+ void
+ crossremint(irq)
+ int irq;
+ {
+ remove_isr(&crid[irq]->cid_isr);
+ FREE(crid[irq], M_DEVBUF);
+ crid[irq] = 0;
+ crossp->cd_imask &= ~(1 << cross_int_map[irq + 1]);
+ CROSS_ENABLE_INTS (crossp->cd_zargs.va, crossp->cd_imask);
+ }
+ #endif
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/crossreg.h
***************
*** 0 ****
--- 1,133 ----
+ /* $NetBSD: crossreg.h,v 1.1 1994/07/08 23:32:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1994 Niklas Hallqvist, Carsten Hammer
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christian E. Hopps.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #ifndef _CROSSREG_H_
+ #define _CROSSREG_H_
+ /***
+ *
+ *
+ * Hardware description:
+ *
+ * The CrossLink board is a 64K autoconfig device. The board address can be
+ * read from the xlink.resource structure instead of searching with the
+ * expansion library. In this way, the manufacturer ID is not required by
+ * the software developer.
+ *
+ * Address mapping is as follows:
+ * XL_ROM 16K of byte wide ROM appearing at even locations.
+ * Used to hold the xlink.resource, and any autobooting
+ * devices.
+ * XL_MEM Memory space. For 8 bit cards, bytes appear at even
+ * locations, (ie multiply address by 2). For 16 bit cards,
+ * words appear at long word boundaries (ie multiply by
+ * 2). You can read bytes from 16 bit cards - odd bytes
+ * will appear at odd locations. SBHE must be set to the
+ * appropriate value for this. Multiple pages are accessible
+ * via the page register (see MemPage register).
+ * XL_IO I/O space. 8K of I/O space is supported by the hardware,
+ * however only 1K is managed by this resource (as IBM's
+ * *never* have cards which decode more I/O space than this).
+ * You should AllocPortSpace() the area you want to use to
+ * get exclusive access before using the I/O. 8/16 bit cards
+ * read/write bytes/words at word boundaries. (You should know
+ * whether the port is 8 or 16 bits wide).
+ *
+ * Within the 1K I/O space, there are some 8 and 16 bit registers on the
+ * xlink board itself. These registers are normally only accessed by
+ * the xlink.resource, they are only described here for completeness.
+ * Later revisions of the CrossLink board may move/change the meaning
+ * of these registers. They are as follows:
+ * (actual address = SBP_xxxx + SB_IO + board address)
+ *
+ * XLP_LATCH (Write Only) (offset = 2)
+ * Latches most significant address lines. D0-D6 contain the
+ * values for the most significant 7 address lines (A13-A19).
+ * D7 contains data for SBHE line (always 1 for 8 bit transfers
+ * on 8 bit boards, and 16 bit transfers on 16 bit boards.
+ * Set SBHE to 0 to perform 8 bit transfers on 16 bit boards).
+ *
+ * XLP_INTABLE (Write Only) (offset = 0)
+ * Interrupt Enable & Disable. Bits map to the interrupts in
+ * the following manner:
+ * Data Interrupt Data Interrupt
+ * 2 10 10 2
+ * 3 11 11 3
+ * 4 12 12 4
+ * 5 Master 13 5
+ * 6 14 14 6
+ * 7 15 15 7
+ * Unused bits should not be interpreted in any way. When
+ * writing to this register, unused bits should be zero. This
+ * register should only be used by the xlink.resource.
+ *
+ * XLP_INTSTAT (Read Only) (offset = 0)
+ * Interrupt Status. Bit mapping is the same as the
+ * XLP_INTABLE location. Normally you only need to add your
+ * interrupt handler to the appropriate port, and not worry
+ * about this register. However, it can be also used to
+ * determine which interrupt a board is connected to.
+ **/
+ /* hardware offsets from config address */
+
+ #define CROSS_XL_ROM 0x8000
+ #define CROSS_XL_MEM 0x4000
+ #define CROSS_XL_IO 0x0000
+
+ #define CROSS_XLP_INTSTAT 0
+ #define CROSS_XLP_INTABLE 0
+ #define CROSS_XLP_LATCH 2
+
+ #define CROSS_MEMORY_OFFSET (CROSS_XL_MEM - 2 * 0x90000)
+ #define CROSS_SBHE 0x40
+
+ #define CROSS_GET_STATUS(va) \
+ (*(volatile u_short *)((va) + CROSS_XLP_INTSTAT))
+
+ #define CROSS_MASTER 5
+ /* From what I understand IRQ2 is really IRQ9 -NH */
+ #define CROSS_IRQ9 10
+ #define CROSS_IRQ3 11
+ #define CROSS_IRQ4 12
+ #define CROSS_IRQ5 13
+ #define CROSS_IRQ6 14
+ #define CROSS_IRQ7 15
+ #define CROSS_IRQ10 2
+ #define CROSS_IRQ11 3
+ #define CROSS_IRQ12 4
+ #define CROSS_IRQ14 6
+ #define CROSS_IRQ15 7
+ #define CROSS_IRQMASK 0xfcdc
+ #define CROSS_GET_INT_STATUS(va) (CROSS_GET_STATUS(va) & CROSS_IRQMASK)
+
+ #define CROSS_ENABLE_INTS(va, ints) \
+ (*(volatile u_short *)((va) + CROSS_XLP_INTABLE) = ints)
+
+ #endif
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/crossvar.h
***************
*** 0 ****
--- 1,46 ----
+ /* $NetBSD: crossvar.h,v 1.1 1994/07/08 23:32:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1994 Niklas Hallqvist
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christian E. Hopps.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #ifndef _CROSSVAR_H_
+ #define _CROSSVAR_H_
+
+ struct cross_device {
+ struct device cd_dev;
+ struct zbus_args cd_zargs;
+ struct isa_link cd_link;
+ int (*cd_ifunc[16])();
+ void *cd_iarg[16];
+ int cd_ipri[16];
+ int cd_imask;
+ struct isr cd_isr;
+ };
+
+ #endif
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/ggbus.c
***************
*** 0 ****
--- 1,261 ----
+ /* $NetBSD: ggbus.c,v 1.1 1994/07/08 23:32:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1994, 1995 Niklas Hallqvist
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Niklas Hallqvist.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #include <sys/param.h>
+ #include <sys/device.h>
+ #include <sys/kernel.h>
+ #include <sys/malloc.h>
+ #include <sys/syslog.h>
+
+ #include <machine/cpu.h>
+ #include <machine/pio.h>
+
+ #include <dev/isa/isavar.h>
+
+ #include <amiga/amiga/custom.h>
+ #include <amiga/amiga/device.h>
+ #include <amiga/amiga/isr.h>
+ #include <amiga/dev/zbusvar.h>
+ #include <amiga/isa/isa_machdep.h>
+ #include <amiga/isa/isa_intr.h>
+ #include <amiga/isa/ggbusvar.h>
+ #include <amiga/isa/ggbusreg.h>
+
+ int ggdebug = 0;
+ int ggstrayints = 0;
+
+ /* This is OK because we only allow one ISA bus. */
+ struct ggbus_device *ggbusp;
+
+ void ggbusattach __P((struct device *, struct device *, void *));
+ int ggbusmatch __P((struct device *, void *, void *));
+ int ggbusprint __P((void *auxp, char *));
+ void ggbusstb __P((struct device *, int, u_char));
+ u_char ggbusldb __P((struct device *, int));
+ void ggbusstw __P((struct device *, int, u_short));
+ u_short ggbusldw __P((struct device *, int));
+ void *ggbus_establish_intr __P((int intr, isa_intrtype type,
+ isa_intrlevel level,
+ int (*ih_fun) (void *), void *));
+ void ggbus_disestablish_intr __P((void *handler));
+
+ struct isa_intr_fcns ggbus_intr_fcns = {
+ 0 /* ggbus_intr_setup */, ggbus_establish_intr,
+ ggbus_disestablish_intr, 0 /* ggbus_iointr */
+ };
+
+ struct cfdriver ggbuscd = {
+ NULL, "ggbus", ggbusmatch, ggbusattach,
+ DV_DULL, sizeof(struct ggbus_device), 0
+ };
+
+ int
+ ggbusmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+ {
+ struct zbus_args *zap = aux;
+
+ /*
+ * Check manufacturer and product id.
+ */
+ if (zap->manid == 2150 && zap->prodid == 1)
+ return(1);
+ return(0);
+ }
+
+ void
+ ggbusattach(pdp, dp, auxp)
+ struct device *pdp, *dp;
+ void *auxp;
+ {
+ struct zbus_args *zap = auxp;
+ struct ggbus_device *gdp = (struct ggbus_device *)dp;
+
+ ggbusp = gdp;
+ bcopy(zap, &gdp->gd_zargs, sizeof(struct zbus_args));
+ gdp->gd_link.il_dev = dp;
+ if (gdp->gd_zargs.serno >= 2)
+ {
+ gdp->gd_link.il_ldb = ggbusldb;
+ gdp->gd_link.il_stb = ggbusstb;
+ gdp->gd_link.il_ldw = ggbusldw;
+ gdp->gd_link.il_stw = ggbusstw;
+ }
+ else
+ {
+ gdp->gd_link.il_ldb = 0;
+ gdp->gd_link.il_stb = 0;
+ gdp->gd_link.il_ldw = 0;
+ gdp->gd_link.il_stw = 0;
+ }
+ gdp->gd_imask = 0;
+
+ isa_intr_fcns = &ggbus_intr_fcns;
+ isa_pio_fcns = &ggbus_pio_fcns;
+
+ if (gdp->gd_zargs.serno >= 2)
+ {
+ /* XXX turn on wait states unconditionally for now. */
+ GG2_ENABLE_WAIT(zap->va);
+ GG2_ENABLE_INTS(zap->va);
+ }
+
+ printf(": pa 0x%08x va 0x%08x size 0x%x\n", zap->pa, zap->va, zap->size);
+
+ /*
+ * attempt to configure the board.
+ */
+ config_found(dp, &gdp->gd_link, ggbusprint);
+ }
+
+ int
+ ggbusprint(auxp, pnp)
+ void *auxp;
+ char *pnp;
+ {
+ if (pnp == NULL)
+ return(QUIET);
+ return(UNCONF);
+ }
+
+
+ void
+ ggbusstb(dev, ia, b)
+ struct device *dev;
+ int ia;
+ u_char b;
+ {
+ struct ggbus_device *gd = (struct ggbus_device *)dev;
+
+ *(volatile u_char *)(gd->gd_zargs.va + GG2_MEMORY_OFFSET + 2 * ia + 1) = b;
+ }
+
+ u_char
+ ggbusldb(dev, ia)
+ struct device *dev;
+ int ia;
+ {
+ struct ggbus_device *gd = (struct ggbus_device *)dev;
+ u_char retval =
+ *(volatile u_char *)(gd->gd_zargs.va + GG2_MEMORY_OFFSET + 2 * ia + 1);
+
+ #ifdef DEBUG
+ if (ggdebug)
+ printf("ldb 0x%x => 0x%x\n", ia, retval);
+ #endif
+ return retval;
+ }
+
+ void
+ ggbusstw(dev, ia, w)
+ struct device *dev;
+ int ia;
+ u_short w;
+ {
+ struct ggbus_device *gd = (struct ggbus_device *)dev;
+
+ *(volatile u_short *)(gd->gd_zargs.va + GG2_MEMORY_OFFSET + 2 * ia) = swap(w);
+ }
+
+ u_short
+ ggbusldw(dev, ia)
+ struct device *dev;
+ int ia;
+ {
+ struct ggbus_device *gd = (struct ggbus_device *)dev;
+ u_short retval =
+ swap(*(volatile u_short *)(gd->gd_zargs.va + GG2_MEMORY_OFFSET + 2 * ia));
+
+ #ifdef DEBUG
+ if (ggdebug)
+ printf("ldw 0x%x => 0x%x\n", ia, retval);
+ #endif
+ return retval;
+ }
+
+ static ggbus_int_map[] = {
+ 0, 0, 0, 0, GG2_IRQ3, GG2_IRQ4, GG2_IRQ5, GG2_IRQ6, GG2_IRQ7, 0,
+ GG2_IRQ9, GG2_IRQ10, GG2_IRQ11, GG2_IRQ12, 0, GG2_IRQ14, GG2_IRQ15
+ };
+
+ struct ggintr_desc {
+ struct isr gid_isr;
+ int gid_mask;
+ int (*gid_fun)(void *);
+ void *gid_arg;
+ };
+
+ static struct ggintr_desc *ggid[16]; /* XXX */
+
+ int
+ ggbusintr(gid)
+ struct ggintr_desc *gid;
+ {
+ return (GG2_GET_STATUS (ggbusp->gd_zargs.va) & gid->gid_mask) ?
+ (*gid->gid_fun)(gid->gid_arg) : 0;
+ }
+
+ void *
+ ggbus_establish_intr(intr, type, level, ih_fun, ih_arg)
+ int intr;
+ isa_intrtype type;
+ isa_intrlevel level;
+ int (*ih_fun)(void *);
+ void *ih_arg;
+ {
+ if (ggid[intr]) {
+ log(LOG_WARNING, "ISA interrupt %d already handled\n", intr);
+ return 0;
+ }
+ MALLOC(ggid[intr], struct ggintr_desc *, sizeof(struct ggintr_desc),
+ M_DEVBUF, M_WAITOK);
+ ggid[intr]->gid_isr.isr_intr = ggbusintr;
+ ggid[intr]->gid_isr.isr_arg = ggid[intr];
+ ggid[intr]->gid_isr.isr_ipl = 6;
+ ggid[intr]->gid_isr.isr_mapped_ipl = level;
+ ggid[intr]->gid_mask = 1 << ggbus_int_map[intr + 1];
+ ggid[intr]->gid_fun = ih_fun;
+ ggid[intr]->gid_arg = ih_arg;
+ add_isr(&ggid[intr]->gid_isr);
+ return &ggid[intr];
+ }
+
+ void
+ ggbus_disestablish_intr(handler)
+ void *handler;
+ {
+ struct ggintr_desc **gid = handler;
+
+ remove_isr(&(*gid)->gid_isr);
+ FREE(*gid, M_DEVBUF);
+ *gid = 0;
+ }
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/ggbus_pio.c
***************
*** 0 ****
--- 1,114 ----
+ /* $NetBSD: ggbus_pio.c,v 1.1 1995/08/04 14:32:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1995 Niklas Hallqvist
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Niklas Hallqvist.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #include <sys/types.h>
+ #include <sys/device.h>
+
+ #include <machine/pio.h>
+
+ #include <dev/isa/isavar.h>
+
+ #include <amiga/amiga/isr.h>
+ #include <amiga/dev/zbusvar.h>
+ #include <amiga/isa/isa_machdep.h>
+ #include <amiga/isa/ggbusreg.h>
+ #include <amiga/isa/ggbusvar.h>
+
+ extern struct ggbus_device *ggbusp;
+
+ void ggbus_outb __P((int, u_int8_t));
+ u_int8_t ggbus_inb __P((int));
+ void ggbus_outw __P((int, u_int16_t));
+ u_int16_t ggbus_inw __P((int));
+
+ struct isa_pio_fcns ggbus_pio_fcns = {
+ ggbus_inb, isa_insb,
+ ggbus_inw, isa_insw,
+ 0 /* ggbus_inl */, 0 /* ggbus_insl */,
+ ggbus_outb, isa_outsb,
+ ggbus_outw, isa_outsw,
+ 0 /* ggbus_outl */, 0 /* ggbus_outsl */,
+ };
+
+ void
+ ggbus_outb(ia, b)
+ int ia;
+ u_int8_t b;
+ {
+ #ifdef DEBUG
+ if (ggdebug)
+ printf("outb 0x%x,0x%x\n", ia, b);
+ #endif
+ *(volatile u_int8_t *)(ggbusp->gd_zargs.va + 2 * ia + 1) = b;
+ }
+
+ u_int8_t
+ ggbus_inb(ia)
+ int ia;
+ {
+ u_int8_t retval =
+ *(volatile u_int8_t *)(ggbusp->gd_zargs.va + 2 * ia + 1);
+
+
+ #ifdef DEBUG
+ if (ggdebug)
+ printf("inb 0x%x => 0x%x\n", ia, retval);
+ #endif
+ return retval;
+ }
+
+ void
+ ggbus_outw(ia, w)
+ int ia;
+ u_int16_t w;
+ {
+ #ifdef DEBUG
+ if (ggdebug)
+ printf("outw 0x%x,0x%x\n", ia, w);
+ #endif
+ *(volatile u_int16_t *)(ggbusp->gd_zargs.va + 2 * ia) = swap (w);
+ }
+
+ u_int16_t
+ ggbus_inw(ia)
+ int ia;
+ {
+ u_int16_t retval =
+ swap(*(volatile u_int16_t *)(ggbusp->gd_zargs.va + 2 * ia));
+
+
+ #ifdef DEBUG
+ if (ggdebug)
+ printf("inw 0x%x => 0x%x\n", ia, retval);
+ #endif
+ return retval;
+ }
+
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/ggbusreg.h
***************
*** 0 ****
--- 1,67 ----
+ /* $NetBSD: ggbusreg.h,v 1.1 1994/07/08 23:32:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1994 Niklas Hallqvist
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Niklas Hallqvist.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #ifndef _GGBUSREG_H_
+ #define _GGBUSREG_H_
+
+ #define GG2_MEMORY_OFFSET (0x20000 - 2 * 0x90000)
+
+ #define GG2_STATUS 0x18000
+ #define GG2_GET_STATUS(va) (*(volatile u_short *)((va) + GG2_STATUS))
+
+ #define GG2_MASTER 0
+ #define GG2_WAIT 1
+ #define GG2_IRQ3 2
+ #define GG2_IRQ4 3
+ #define GG2_IRQ5 4
+ #define GG2_IRQ6 5
+ #define GG2_IRQ7 6
+ #define GG2_IRQ9 7
+ #define GG2_IRQ10 8
+ #define GG2_IRQ11 9
+ #define GG2_IRQ12 10
+ #define GG2_IRQ14 11
+ #define GG2_IRQ15 12
+ #define GG2_IRQ_MASK 0x1ffc
+ #define GG2_GET_INT_STATUS(va) (GG2_GET_STATUS(va) & GG2_IRQ_MASK)
+
+ #define GG2_INT_CTRL 0x18002
+ #define GG2_DISABLE_INTS(va) (*(volatile u_short *)((va) + GG2_INT_CTRL))
+ #define GG2_ENABLE_INTS(va) (*(volatile u_short *)((va) + GG2_INT_CTRL) = 0)
+
+ #define GG2_WAIT_CTRL 0x18004
+ #define GG2_TOGGLE_WAIT(va) (*(volatile u_char *)((va) + GG2_WAIT_CTRL))
+ #define GG2_ENABLE_WAIT(va) \
+ while ((GG2_GET_STATUS(va) & 1 << GG2_WAIT) == 0) GG2_TOGGLE_WAIT(va)
+ #define GG2_DISABLE_WAIT(va) \
+ while (GG2_GET_STATUS(va) & 1 << GG2_WAIT) GG2_TOGGLE_WAIT(va)
+
+ #endif
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/ggbusvar.h
***************
*** 0 ****
--- 1,50 ----
+ /* $NetBSD: ggbusvar.h,v 1.1 1994/07/08 23:32:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1994, 1995 Niklas Hallqvist
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Niklas Hallqvist.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #ifndef _GGBUSVAR_H_
+ #define _GGBUSVAR_H_
+
+ struct ggbus_device {
+ struct device gd_dev;
+ struct zbus_args gd_zargs;
+ struct isa_link gd_link;
+ int (*gd_ifunc[16])();
+ void *gd_iarg[16];
+ int gd_ipri[16];
+ int gd_imask;
+ struct isr gd_isr;
+ };
+
+ extern int ggdebug;
+
+ #endif
+
+
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/icu.h
***************
*** 0 ****
--- 1,97 ----
+ /*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: @(#)icu.h 5.6 (Berkeley) 5/9/91
+ * $Id$
+ */
+
+ /*
+ * AT/386 Interrupt Control constants
+ * W. Jolitz 8/89
+ */
+
+ #ifndef __ICU__
+ #define __ICU__
+
+ #ifndef LOCORE
+
+ /*
+ * Interrupt "level" mechanism variables, masks, and macros
+ */
+ extern unsigned imen; /* interrupt mask enable */
+
+ #define INTREN(s) do{imen &= ~(s); SET_ICUS();}while(0)
+ #define INTRDIS(s) do{imen |= (s); SET_ICUS();}while(0)
+ #define INTRMASK(msk,s) (msk |= (s))
+ #if 0
+ #define SET_ICUS() do{outb(IO_ICU1 + 1, imen); outb(IU_ICU2 + 1, imen >> 8);}while(0)
+ #else
+ /*
+ * XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to
+ * include isa.h, while too many things include icu.h.
+ */
+ #define SET_ICUS() do{outb(0x21, imen); outb(0xa1, imen >> 8);}while(0)
+ #endif
+
+ #endif
+
+ /*
+ * Interrupt enable bits -- in order of priority
+ */
+ #define IRQ0 0x0001 /* highest priority - timer */
+ #define IRQ1 0x0002
+ #define IRQ_SLAVE 0x0004
+ #define IRQ8 0x0100
+ #define IRQ9 0x0200
+ #define IRQ2 IRQ9
+ #define IRQ10 0x0400
+ #define IRQ11 0x0800
+ #define IRQ12 0x1000
+ #define IRQ13 0x2000
+ #define IRQ14 0x4000
+ #define IRQ15 0x8000
+ #define IRQ3 0x0008
+ #define IRQ4 0x0010
+ #define IRQ5 0x0020
+ #define IRQ6 0x0040
+ #define IRQ7 0x0080 /* lowest - parallel printer */
+
+ /*
+ * Interrupt Control offset into Interrupt descriptor table (IDT)
+ */
+ #define ICU_OFFSET 32 /* 0-31 are processor exceptions */
+ #define ICU_LEN 16 /* 32-47 are ISA interrupts */
+
+ #endif __ICU__
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/if_isaed.c
***************
*** 0 ****
--- 1,2321 ----
+ /* $NetBSD: if_isaed.c,v 1.7 1994/11/28 21:47:38 root Exp $ */
+
+ /*
+ * Copyright (c) 1994, 1995 Niklas Hallqvist.
+ * All rights reserved.
+ *
+ * Amiga adaptation based on:
+ *
+ * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
+ * adapters.
+ *
+ * Copyright (c) 1994, 1995 Charles Hannum.
+ * All rights reserved.
+ *
+ * Copyright (C) 1993, David Greenman. This software may be used, modified,
+ * copied, distributed, and sold, in both source and binary form provided that
+ * the above copyright and these terms are retained. Under no circumstances is
+ * the author responsible for the proper functioning of this software, nor does
+ * the author assume any responsibility for damages incurred with its use.
+ *
+ * Currently supports the Western Digital/SMC 8003 and 8013 series, the SMC
+ * Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000, and a variety of
+ * similar clones.
+ */
+
+ #include "bpfilter.h"
+
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/errno.h>
+ #include <sys/ioctl.h>
+ #include <sys/mbuf.h>
+ #include <sys/socket.h>
+ #include <sys/syslog.h>
+ #include <sys/device.h>
+
+ #include <net/if.h>
+ #include <net/if_dl.h>
+ #include <net/if_types.h>
+ #include <net/netisr.h>
+
+ #ifdef INET
+ #include <netinet/in.h>
+ #include <netinet/in_systm.h>
+ #include <netinet/in_var.h>
+ #include <netinet/ip.h>
+ #include <netinet/if_ether.h>
+ #endif
+
+ #ifdef NS
+ #include <netns/ns.h>
+ #include <netns/ns_if.h>
+ #endif
+
+ #if NBPFILTER > 0
+ #include <net/bpf.h>
+ #include <net/bpfdesc.h>
+ #endif
+
+ #include <machine/cpu.h>
+ #include <machine/pio.h>
+
+ #include <dev/isa/isareg.h>
+ #include <dev/isa/isavar.h>
+ #include <dev/isa/if_edreg.h>
+
+ #define ED_BYTE_ORDER LITTLE_ENDIAN
+ #include <dev/ic/dp8390reg.h>
+
+ #include <amiga/isa/isa_machdep.h> /* XXX USES ISA HOLE DIRECTLY */
+
+ /*
+ * isaed_softc: per line info and status
+ */
+ struct isaed_softc {
+ struct device sc_dev;
+ void *sc_ih;
+
+ struct arpcom sc_arpcom; /* ethernet common */
+
+ char *type_str; /* pointer to type string */
+ u_char vendor; /* interface vendor */
+ u_char type; /* interface type code */
+
+ int asic_addr; /* ASIC I/O bus address */
+ int nic_addr; /* NIC (DS8390) I/O bus address */
+
+ /*
+ * The following 'proto' variable is part of a work-around for 8013EBT asics
+ * being write-only. It's sort of a prototype/shadow of the real thing.
+ */
+ u_char wd_laar_proto;
+ /*
+ * This `proto' variable is so we can turn MENB on and off without reading
+ * the value back from the card all the time.
+ */
+ u_char wd_msr_proto;
+ u_char cr_proto; /* values always set in CR */
+ u_char isa16bit; /* width of access to card 0=8 or 1=16 */
+ u_char is790; /* set by probe if NIC is a 790 */
+
+ caddr_t mem_start; /* NIC memory start address */
+ caddr_t mem_end; /* NIC memory end address */
+ u_long mem_size; /* total NIC memory size */
+ caddr_t mem_ring; /* start of RX ring-buffer (in NIC mem) */
+
+ u_char mem_shared; /* NIC memory is shared with host */
+ u_char txb_cnt; /* number of transmit buffers */
+ u_char txb_inuse; /* number of transmit buffers active */
+
+ u_char txb_new; /* pointer to where new buffer will be added */
+ u_char txb_next_tx; /* pointer to next buffer ready to xmit */
+ u_short txb_len[8]; /* buffered xmit buffer lengths */
+ u_char tx_page_start; /* first page of TX buffer area */
+ u_char rec_page_start; /* first page of RX ring-buffer */
+ u_char rec_page_stop; /* last page of RX ring-buffer */
+ u_char next_packet; /* pointer to next unread RX packet */
+ };
+
+ int isaedprobe __P((struct device *, void *, void *));
+ void isaedattach __P((struct device *, struct device *, void *));
+ int isaedintr __P((void *));
+ int isaedioctl __P((struct ifnet *, u_long, caddr_t));
+ void isaedstart __P((struct ifnet *));
+ void isaedwatchdog __P((int));
+ void isaedreset __P((struct isaed_softc *));
+ void isaedinit __P((struct isaed_softc *));
+ void isaedstop __P((struct isaed_softc *));
+
+ #define inline /* XXX for debugging porpoises */
+
+ void isaed_getmcaf __P((struct arpcom *, u_long *));
+ void isaedread __P((struct isaed_softc *, caddr_t, int));
+ struct mbuf *isaedget __P((struct isaed_softc *, caddr_t, int));
+ static inline void isaed_rint __P((struct isaed_softc *));
+ static inline void isaed_xmit __P((struct isaed_softc *));
+ static inline caddr_t isaed_ring_copy __P((struct isaed_softc *, caddr_t,
+ caddr_t, u_short));
+
+ void isaed_pio_readmem __P((struct isaed_softc *, u_short, caddr_t, u_short));
+ void isaed_pio_writemem __P((struct isaed_softc *, caddr_t, u_short, u_short));
+ u_short isaed_pio_write_mbufs __P((struct isaed_softc *, struct mbuf *, u_short));
+
+ #ifdef ISAED_DEBUG
+ int isaeddebug = 0;
+ #endif
+ int isaedprobes = 7;
+
+ struct cfdriver isaedcd = {
+ NULL, "isaed", isaedprobe, isaedattach, DV_IFNET, sizeof(struct isaed_softc)
+ };
+
+ #define ETHER_MIN_LEN 64
+ #define ETHER_MAX_LEN 1518
+ #define ETHER_ADDR_LEN 6
+
+ #define NIC_PUT(sc, off, val) outb(sc->nic_addr + off, val)
+ #define NIC_GET(sc, off) inb(sc->nic_addr + off)
+
+ /*
+ * Determine if the device is present.
+ */
+ int
+ isaedprobe(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+ {
+ struct isaed_softc *sc = match;
+ struct cfdata *cf = sc->sc_dev.dv_cfdata;
+ struct isa_attach_args *ia = aux;
+
+ if ((isaedprobes & 1) && isaed_probe_WD80x3(sc, cf, ia))
+ return (1);
+ if ((isaedprobes & 2) && isaed_probe_3Com(sc, cf, ia))
+ return (1);
+ if ((isaedprobes & 4) && isaed_probe_Novell(sc, cf, ia))
+ return (1);
+ return (0);
+ }
+
+ /*
+ * Generic probe routine for testing for the existance of a DS8390. Must be
+ * called after the NIC has just been reset. This routine works by looking at
+ * certain register values that are guaranteed to be initialized a certain way
+ * after power-up or reset. Seems not to currently work on the 83C690.
+ *
+ * Specifically:
+ *
+ * Register reset bits set bits
+ * Command Register (CR) TXP, STA RD2, STP
+ * Interrupt Status (ISR) RST
+ * Interrupt Mask (IMR) All bits
+ * Data Control (DCR) LAS
+ * Transmit Config. (TCR) LB1, LB0
+ *
+ * We only look at the CR and ISR registers, however, because looking at the
+ * others would require changing register pages (which would be intrusive if
+ * this isn't an 8390).
+ *
+ * Return 1 if 8390 was found, 0 if not.
+ */
+ int
+ isaed_probe_generic8390(sc)
+ struct isaed_softc *sc;
+ {
+
+ if ((NIC_GET(sc, ED_P0_CR) &
+ (ED_CR_RD2 | ED_CR_TXP | ED_CR_STA | ED_CR_STP)) !=
+ (ED_CR_RD2 | ED_CR_STP))
+ return (0);
+ if ((NIC_GET(sc, ED_P0_ISR) & ED_ISR_RST) != ED_ISR_RST)
+ return (0);
+
+ return (1);
+ }
+
+ int isaed_wd584_irq[] = { 9, 3, 5, 7, 10, 11, 15, 4 };
+ int isaed_wd790_irq[] = { IRQUNK, 9, 3, 5, 7, 10, 11, 15 };
+
+ /*
+ * Probe and vendor-specific initialization routine for SMC/WD80x3 boards.
+ */
+ int
+ isaed_probe_WD80x3(sc, cf, ia)
+ struct isaed_softc *sc;
+ struct cfdata *cf;
+ struct isa_attach_args *ia;
+ {
+ int i;
+ u_int memsize;
+ u_char iptr, isa16bit, sum;
+
+ sc->asic_addr = ia->ia_iobase;
+ sc->nic_addr = sc->asic_addr + ED_WD_NIC_OFFSET;
+ sc->is790 = 0;
+
+ #ifdef TOSH_ETHER
+ outb(sc->asic_addr + ED_WD_MSR, ED_WD_MSR_POW);
+ delay(10000);
+ #endif
+
+ /*
+ * Attempt to do a checksum over the station address PROM. If it
+ * fails, it's probably not a SMC/WD board. There is a problem with
+ * this, though: some clone WD boards don't pass the checksum test.
+ * Danpex boards for one.
+ */
+ for (sum = 0, i = 0; i < 8; ++i) {
+ u_char c = inb(sc->asic_addr + ED_WD_PROM + i);
+
+ sum += c;
+ #ifdef ISAED_DEBUG
+ if (isaeddebug)
+ printf("inb(0x%x) = 0x%02x -> sum = %d\n",
+ sc->asic_addr + ED_WD_PROM + i, c, sum);
+ #endif
+ }
+
+ if (sum != ED_WD_ROM_CHECKSUM_TOTAL) {
+ /*
+ * Checksum is invalid. This often happens with cheap WD8003E
+ * clones. In this case, the checksum byte (the eighth byte)
+ * seems to always be zero.
+ */
+ if (inb(sc->asic_addr + ED_WD_CARD_ID) != ED_TYPE_WD8003E ||
+ inb(sc->asic_addr + ED_WD_PROM + 7) != 0)
+ return (0);
+ }
+
+ /* Reset card to force it into a known state. */
+ #ifdef TOSH_ETHER
+ outb(sc->asic_addr + ED_WD_MSR, ED_WD_MSR_RST | ED_WD_MSR_POW);
+ #else
+ outb(sc->asic_addr + ED_WD_MSR, ED_WD_MSR_RST);
+ #endif
+ delay(100);
+ outb(sc->asic_addr + ED_WD_MSR,
+ inb(sc->asic_addr + ED_WD_MSR) & ~ED_WD_MSR_RST);
+ /* Wait in the case this card is reading it's EEROM. */
+ delay(5000);
+
+ sc->vendor = ED_VENDOR_WD_SMC;
+ sc->type = inb(sc->asic_addr + ED_WD_CARD_ID);
+
+ /* Set initial values for width/size. */
+ memsize = 8192;
+ isa16bit = 0;
+ switch (sc->type) {
+ case ED_TYPE_WD8003S:
+ sc->type_str = "WD8003S";
+ break;
+ case ED_TYPE_WD8003E:
+ sc->type_str = "WD8003E";
+ break;
+ case ED_TYPE_WD8003EB:
+ sc->type_str = "WD8003EB";
+ break;
+ case ED_TYPE_WD8003W:
+ sc->type_str = "WD8003W";
+ break;
+ case ED_TYPE_WD8013EBT:
+ sc->type_str = "WD8013EBT";
+ memsize = 16384;
+ isa16bit = 1;
+ break;
+ case ED_TYPE_WD8013W:
+ sc->type_str = "WD8013W";
+ memsize = 16384;
+ isa16bit = 1;
+ break;
+ case ED_TYPE_WD8013EP: /* also WD8003EP */
+ if (inb(sc->asic_addr + ED_WD_ICR) & ED_WD_ICR_16BIT) {
+ isa16bit = 1;
+ memsize = 16384;
+ sc->type_str = "WD8013EP";
+ } else
+ sc->type_str = "WD8003EP";
+ break;
+ case ED_TYPE_WD8013WC:
+ sc->type_str = "WD8013WC";
+ memsize = 16384;
+ isa16bit = 1;
+ break;
+ case ED_TYPE_WD8013EBP:
+ sc->type_str = "WD8013EBP";
+ memsize = 16384;
+ isa16bit = 1;
+ break;
+ case ED_TYPE_WD8013EPC:
+ sc->type_str = "WD8013EPC";
+ memsize = 16384;
+ isa16bit = 1;
+ break;
+ case ED_TYPE_SMC8216C:
+ sc->type_str = "SMC8216/SMC8216C";
+ memsize = 16384;
+ isa16bit = 1;
+ sc->is790 = 1;
+ break;
+ case ED_TYPE_SMC8216T:
+ sc->type_str = "SMC8216T";
+ memsize = 16384;
+ isa16bit = 1;
+ sc->is790 = 1;
+ break;
+ #ifdef TOSH_ETHER
+ case ED_TYPE_TOSHIBA1:
+ sc->type_str = "Toshiba1";
+ memsize = 32768;
+ isa16bit = 1;
+ break;
+ case ED_TYPE_TOSHIBA4:
+ sc->type_str = "Toshiba4";
+ memsize = 32768;
+ isa16bit = 1;
+ break;
+ #endif
+ default:
+ sc->type_str = NULL;
+ break;
+ }
+ /*
+ * Make some adjustments to initial values depending on what is found
+ * in the ICR.
+ */
+ if (isa16bit && (sc->type != ED_TYPE_WD8013EBT) &&
+ #ifdef TOSH_ETHER
+ (sc->type != ED_TYPE_TOSHIBA1) && (sc->type != ED_TYPE_TOSHIBA4) &&
+ #endif
+ ((inb(sc->asic_addr + ED_WD_ICR) & ED_WD_ICR_16BIT) == 0)) {
+ isa16bit = 0;
+ memsize = 8192;
+ }
+
+ #ifdef ISAED_DEBUG
+ if (isaeddebug) {
+ printf("type=%x type_str=%s isa16bit=%d memsize=%d ia_msize=%d\n",
+ sc->type, sc->type_str ?: "unknown", isa16bit, memsize,
+ ia->ia_msize);
+ for (i = 0; i < 8; i++)
+ printf("%x -> %x\n", i, inb(sc->asic_addr + i));
+ }
+ #endif
+ /* Allow the user to override the autoconfiguration. */
+ if (ia->ia_msize)
+ memsize = ia->ia_msize;
+ /*
+ * (Note that if the user specifies both of the following flags that
+ * '8-bit' mode intentionally has precedence.)
+ */
+ if (cf->cf_flags & ED_FLAGS_FORCE_16BIT_MODE)
+ isa16bit = 1;
+ if (cf->cf_flags & ED_FLAGS_FORCE_8BIT_MODE)
+ isa16bit = 0;
+
+ /*
+ * If possible, get the assigned interrupt number from the card and
+ * use it.
+ */
+ if (sc->is790) {
+ u_char x;
+ /* Assemble together the encoded interrupt number. */
+ outb(ia->ia_iobase + ED_WD790_HWR,
+ inb(ia->ia_iobase + ED_WD790_HWR) | ED_WD790_HWR_SWH);
+ x = inb(ia->ia_iobase + ED_WD790_GCR);
+ iptr = ((x & ED_WD790_GCR_IR2) >> 4) |
+ ((x & (ED_WD790_GCR_IR1|ED_WD790_GCR_IR0)) >> 2);
+ outb(ia->ia_iobase + ED_WD790_HWR,
+ inb(ia->ia_iobase + ED_WD790_HWR) & ~ED_WD790_HWR_SWH);
+ /*
+ * Translate it using translation table, and check for
+ * correctness.
+ */
+ if (ia->ia_irq != IRQUNK) {
+ if (ia->ia_irq != isaed_wd790_irq[iptr]) {
+ printf("%s: irq mismatch; kernel configured %d != board configured %d\n",
+ sc->sc_dev.dv_xname, ia->ia_irq,
+ isaed_wd790_irq[iptr]);
+ return (0);
+ }
+ } else
+ ia->ia_irq = isaed_wd790_irq[iptr];
+ /* Enable the interrupt. */
+ outb(ia->ia_iobase + ED_WD790_ICR,
+ inb(ia->ia_iobase + ED_WD790_ICR) | ED_WD790_ICR_EIL);
+ } else if (sc->type & ED_WD_SOFTCONFIG) {
+ /* Assemble together the encoded interrupt number. */
+ iptr = (inb(ia->ia_iobase + ED_WD_ICR) & ED_WD_ICR_IR2) |
+ ((inb(ia->ia_iobase + ED_WD_IRR) &
+ (ED_WD_IRR_IR0 | ED_WD_IRR_IR1)) >> 5);
+ /*
+ * Translate it using translation table, and check for
+ * correctness.
+ */
+ if (ia->ia_irq != IRQUNK) {
+ if (ia->ia_irq != isaed_wd584_irq[iptr]) {
+ printf("%s: irq mismatch; kernel configured %d != board configured %d\n",
+ sc->sc_dev.dv_xname, ia->ia_irq,
+ isaed_wd584_irq[iptr]);
+ return (0);
+ }
+ } else
+ ia->ia_irq = isaed_wd584_irq[iptr];
+ /* Enable the interrupt. */
+ outb(ia->ia_iobase + ED_WD_IRR,
+ inb(ia->ia_iobase + ED_WD_IRR) | ED_WD_IRR_IEN);
+ } else {
+ if (ia->ia_irq == IRQUNK) {
+ printf("%s: %s does not have soft configuration\n",
+ sc->sc_dev.dv_xname, sc->type_str);
+ return (0);
+ }
+ }
+
+ /* XXX Figure out the shared memory address. */
+
+ sc->isa16bit = isa16bit;
+ sc->mem_shared = 1;
+ ia->ia_msize = memsize;
+ sc->mem_start = ISA_HOLE_VADDR(ia->ia_maddr);
+
+ /* Allocate one xmit buffer if < 16k, two buffers otherwise. */
+ if ((memsize < 16384) || (cf->cf_flags & ED_FLAGS_NO_MULTI_BUFFERING))
+ sc->txb_cnt = 1;
+ else
+ sc->txb_cnt = 2;
+
+ sc->tx_page_start = ED_WD_PAGE_OFFSET;
+ sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
+ sc->rec_page_stop = sc->tx_page_start + (memsize >> ED_PAGE_SHIFT);
+ sc->mem_ring = sc->mem_start + (sc->rec_page_start << ED_PAGE_SHIFT);
+ sc->mem_size = memsize;
+ sc->mem_end = sc->mem_start + memsize;
+
+ /* Get station address from on-board ROM. */
+ for (i = 0; i < ETHER_ADDR_LEN; ++i)
+ sc->sc_arpcom.ac_enaddr[i] =
+ inb(sc->asic_addr + ED_WD_PROM + i);
+
+ /*
+ * Set upper address bits and 8/16 bit access to shared memory.
+ */
+ if (isa16bit) {
+ if (sc->is790) {
+ sc->wd_laar_proto =
+ inb(sc->asic_addr + ED_WD_LAAR) &
+ ~ED_WD_LAAR_M16EN;
+ } else {
+ sc->wd_laar_proto =
+ ED_WD_LAAR_L16EN |
+ ((kvtop(sc->mem_start) >> 19) &
+ ED_WD_LAAR_ADDRHI);
+ }
+ outb(sc->asic_addr + ED_WD_LAAR,
+ sc->wd_laar_proto | ED_WD_LAAR_M16EN);
+ } else {
+ if ((sc->type & ED_WD_SOFTCONFIG) ||
+ #ifdef TOSH_ETHER
+ (sc->type == ED_TYPE_TOSHIBA1) ||
+ (sc->type == ED_TYPE_TOSHIBA4) ||
+ #endif
+ (sc->type == ED_TYPE_WD8013EBT) && !sc->is790) {
+ sc->wd_laar_proto =
+ ((kvtop(sc->mem_start) >> 19) &
+ ED_WD_LAAR_ADDRHI);
+ outb(sc->asic_addr + ED_WD_LAAR,
+ sc->wd_laar_proto);
+ }
+ }
+
+ /*
+ * Set address and enable interface shared memory.
+ */
+ if (!sc->is790) {
+ #ifdef TOSH_ETHER
+ outb(sc->asic_addr + ED_WD_MSR + 1,
+ ((kvtop(sc->mem_start) >> 8) & 0xe0) | 4);
+ outb(sc->asic_addr + ED_WD_MSR + 2,
+ ((kvtop(sc->mem_start) >> 16) & 0x0f));
+ sc->wd_msr_proto = ED_WD_MSR_POW;
+ #else
+ sc->wd_msr_proto =
+ (kvtop(sc->mem_start) >> 13) & ED_WD_MSR_ADDR;
+ #endif
+ sc->cr_proto = ED_CR_RD2;
+ } else {
+ outb(sc->asic_addr + 0x04,
+ inb(sc->asic_addr + 0x04) | 0x80);
+ outb(sc->asic_addr + 0x0b,
+ ((kvtop(sc->mem_start) >> 13) & 0x0f) |
+ ((kvtop(sc->mem_start) >> 11) & 0x40) |
+ (inb(sc->asic_addr + 0x0b) & 0xb0));
+ outb(sc->asic_addr + 0x04,
+ inb(sc->asic_addr + 0x04) & ~0x80);
+ sc->wd_msr_proto = 0x00;
+ sc->cr_proto = 0;
+ }
+ outb(sc->asic_addr + ED_WD_MSR,
+ sc->wd_msr_proto | ED_WD_MSR_MENB);
+
+ (void) inb(0x84);
+ (void) inb(0x84);
+
+ /* Now zero memory and verify that it is clear. */
+ bzero(sc->mem_start, memsize);
+
+ for (i = 0; i < memsize; ++i)
+ if (sc->mem_start[i]) {
+ printf("%s: failed to clear shared memory at %x - check configuration\n",
+ sc->sc_dev.dv_xname,
+ kvtop(sc->mem_start + i));
+
+ /* Disable 16 bit access to shared memory. */
+ outb(sc->asic_addr + ED_WD_MSR,
+ sc->wd_msr_proto);
+ if (isa16bit)
+ outb(sc->asic_addr + ED_WD_LAAR,
+ sc->wd_laar_proto);
+ (void) inb(0x84);
+ (void) inb(0x84);
+ return (0);
+ }
+
+ /*
+ * Disable 16bit access to shared memory - we leave it disabled
+ * so that 1) machines reboot properly when the board is set 16
+ * 16 bit mode and there are conflicting 8bit devices/ROMS in
+ * the same 128k address space as this boards shared memory,
+ * and 2) so that other 8 bit devices with shared memory can be
+ * used in this 128k region, too.
+ */
+ outb(sc->asic_addr + ED_WD_MSR, sc->wd_msr_proto);
+ if (isa16bit)
+ outb(sc->asic_addr + ED_WD_LAAR, sc->wd_laar_proto);
+ (void) inb(0x84);
+ (void) inb(0x84);
+
+ ia->ia_iosize = ED_WD_IO_PORTS;
+ return (1);
+ }
+
+ int isaed_3com_iobase[] = {0x2e0, 0x2a0, 0x280, 0x250, 0x350, 0x330, 0x310, 0x300};
+ int isaed_3com_maddr[] = {MADDRUNK, MADDRUNK, MADDRUNK, MADDRUNK, 0xc8000, 0xcc000, 0xd8000, 0xdc000};
+ #if 0
+ int isaed_3com_irq[] = {IRQUNK, IRQUNK, IRQUNK, IRQUNK, 9, 3, 4, 5};
+ #endif
+
+ /*
+ * Probe and vendor-specific initialization routine for 3Com 3c503 boards.
+ */
+ int
+ isaed_probe_3Com(sc, cf, ia)
+ struct isaed_softc *sc;
+ struct cfdata *cf;
+ struct isa_attach_args *ia;
+ {
+ int i;
+ u_int memsize;
+ u_char isa16bit, sum, x;
+ int ptr;
+
+ sc->asic_addr = ia->ia_iobase + ED_3COM_ASIC_OFFSET;
+ sc->nic_addr = ia->ia_iobase + ED_3COM_NIC_OFFSET;
+
+ /*
+ * Verify that the kernel configured I/O address matches the board
+ * configured address.
+ *
+ * This is really only useful to see if something that looks like the
+ * board is there; after all, we are already talking it at that
+ * address.
+ */
+ x = inb(sc->asic_addr + ED_3COM_BCFR);
+ if (x == 0 || (x & (x - 1)) != 0)
+ return (0);
+ ptr = ffs(x) - 1;
+ if (ia->ia_iobase != IOBASEUNK) {
+ if (ia->ia_iobase != isaed_3com_iobase[ptr]) {
+ printf("%s: %s mismatch; kernel configured %x != board configured %x\n",
+ "iobase", sc->sc_dev.dv_xname, ia->ia_iobase,
+ isaed_3com_iobase[ptr]);
+ return (0);
+ }
+ } else
+ ia->ia_iobase = isaed_3com_iobase[ptr];
+
+ x = inb(sc->asic_addr + ED_3COM_PCFR);
+ if (x == 0 || (x & (x - 1)) != 0)
+ return (0);
+ ptr = ffs(x) - 1;
+ if (ia->ia_maddr != MADDRUNK) {
+ if (ia->ia_maddr != isaed_3com_maddr[ptr]) {
+ printf("%s: %s mismatch; kernel configured %x != board configured %x\n",
+ "maddr", sc->sc_dev.dv_xname, ia->ia_maddr,
+ isaed_3com_maddr[ptr]);
+ return (0);
+ }
+ } else
+ ia->ia_maddr = isaed_3com_maddr[ptr];
+
+ #if 0
+ x = inb(sc->asic_addr + ED_3COM_IDCFR) & ED_3COM_IDCFR_IRQ;
+ if (x == 0 || (x & (x - 1)) != 0)
+ return (0);
+ ptr = ffs(x) - 1;
+ if (ia->ia_irq != IRQUNK) {
+ if (ia->ia_irq != isaed_3com_irq[ptr]) {
+ printf("%s: irq mismatch; kernel configured %d != board configured %d\n",
+ sc->sc_dev.dv_xname, ia->ia_irq,
+ isaed_3com_irq[ptr]);
+ return (0);
+ }
+ } else
+ ia->ia_irq = isaed_3com_irq[ptr];
+ #endif
+
+ /*
+ * Reset NIC and ASIC. Enable on-board transceiver throughout reset
+ * sequence because it'll lock up if the cable isn't connected if we
+ * don't.
+ */
+ outb(sc->asic_addr + ED_3COM_CR, ED_3COM_CR_RST | ED_3COM_CR_XSEL);
+
+ /* Wait for a while, then un-reset it. */
+ delay(50);
+
+ /*
+ * The 3Com ASIC defaults to rather strange settings for the CR after a
+ * reset - it's important to set it again after the following outb
+ * (this is done when we map the PROM below).
+ */
+ outb(sc->asic_addr + ED_3COM_CR, ED_3COM_CR_XSEL);
+
+ /* Wait a bit for the NIC to recover from the reset. */
+ delay(5000);
+
+ sc->vendor = ED_VENDOR_3COM;
+ sc->type_str = "3c503";
+ sc->mem_shared = 1;
+ sc->cr_proto = ED_CR_RD2;
+
+ /*
+ * Hmmm...a 16bit 3Com board has 16k of memory, but only an 8k window
+ * to it.
+ */
+ memsize = 8192;
+
+ /*
+ * Get station address from on-board ROM.
+ *
+ * First, map ethernet address PROM over the top of where the NIC
+ * registers normally appear.
+ */
+ outb(sc->asic_addr + ED_3COM_CR, ED_3COM_CR_EALO | ED_3COM_CR_XSEL);
+
+ for (i = 0; i < ETHER_ADDR_LEN; ++i)
+ sc->sc_arpcom.ac_enaddr[i] = NIC_GET(sc, i);
+
+ /*
+ * Unmap PROM - select NIC registers. The proper setting of the
+ * tranceiver is set in isaedinit so that the attach code is given a
+ * chance to set the default based on a compile-time config option.
+ */
+ outb(sc->asic_addr + ED_3COM_CR, ED_3COM_CR_XSEL);
+
+ /* Determine if this is an 8bit or 16bit board. */
+
+ /* Select page 0 registers. */
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_PAGE_0 | ED_CR_STP);
+
+ /*
+ * Attempt to clear WTS bit. If it doesn't clear, then this is a
+ * 16-bit board.
+ */
+ NIC_PUT(sc, ED_P0_DCR, 0);
+
+ /* Select page 2 registers. */
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_PAGE_2 | ED_CR_STP);
+
+ /* The 3c503 forces the WTS bit to a one if this is a 16bit board. */
+ if (NIC_GET(sc, ED_P2_DCR) & ED_DCR_WTS)
+ isa16bit = 1;
+ else
+ isa16bit = 0;
+
+ /* Select page 0 registers. */
+ NIC_PUT(sc, ED_P2_CR, ED_CR_RD2 | ED_CR_PAGE_0 | ED_CR_STP);
+
+ sc->mem_start = ISA_HOLE_VADDR(ia->ia_maddr);
+ sc->mem_size = memsize;
+ sc->mem_end = sc->mem_start + memsize;
+
+ /*
+ * We have an entire 8k window to put the transmit buffers on the
+ * 16-bit boards. But since the 16bit 3c503's shared memory is only
+ * fast enough to overlap the loading of one full-size packet, trying
+ * to load more than 2 buffers can actually leave the transmitter idle
+ * during the load. So 2 seems the best value. (Although a mix of
+ * variable-sized packets might change this assumption. Nonetheless,
+ * we optimize for linear transfers of same-size packets.)
+ */
+ if (isa16bit) {
+ if (cf->cf_flags & ED_FLAGS_NO_MULTI_BUFFERING)
+ sc->txb_cnt = 1;
+ else
+ sc->txb_cnt = 2;
+
+ sc->tx_page_start = ED_3COM_TX_PAGE_OFFSET_16BIT;
+ sc->rec_page_start = ED_3COM_RX_PAGE_OFFSET_16BIT;
+ sc->rec_page_stop =
+ (memsize >> ED_PAGE_SHIFT) + ED_3COM_RX_PAGE_OFFSET_16BIT;
+ sc->mem_ring = sc->mem_start;
+ } else {
+ sc->txb_cnt = 1;
+ sc->tx_page_start = ED_3COM_TX_PAGE_OFFSET_8BIT;
+ sc->rec_page_start =
+ ED_TXBUF_SIZE + ED_3COM_TX_PAGE_OFFSET_8BIT;
+ sc->rec_page_stop =
+ (memsize >> ED_PAGE_SHIFT) + ED_3COM_TX_PAGE_OFFSET_8BIT;
+ sc->mem_ring =
+ sc->mem_start + (ED_TXBUF_SIZE << ED_PAGE_SHIFT);
+ }
+
+ sc->isa16bit = isa16bit;
+
+ /*
+ * Initialize GA page start/stop registers. Probably only needed if
+ * doing DMA, but what the Hell.
+ */
+ outb(sc->asic_addr + ED_3COM_PSTR, sc->rec_page_start);
+ outb(sc->asic_addr + ED_3COM_PSPR, sc->rec_page_stop);
+
+ /* Set IRQ. 3c503 only allows a choice of irq 3-5 or 9. */
+ switch (ia->ia_irq) {
+ case 9:
+ outb(sc->asic_addr + ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ2);
+ break;
+ case 3:
+ outb(sc->asic_addr + ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ3);
+ break;
+ case 4:
+ outb(sc->asic_addr + ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ4);
+ break;
+ case 5:
+ outb(sc->asic_addr + ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ5);
+ break;
+ default:
+ printf("%s: invalid irq configuration (%d) must be 3-5 or 9 for 3c503\n",
+ sc->sc_dev.dv_xname, ia->ia_irq);
+ return (0);
+ }
+
+ /*
+ * Initialize GA configuration register. Set bank and enable shared
+ * mem.
+ */
+ outb(sc->asic_addr + ED_3COM_GACFR,
+ ED_3COM_GACFR_RSEL | ED_3COM_GACFR_MBS0);
+
+ /*
+ * Initialize "Vector Pointer" registers. These gawd-awful things are
+ * compared to 20 bits of the address on ISA, and if they match, the
+ * shared memory is disabled. We set them to 0xffff0...allegedly the
+ * reset vector.
+ */
+ outb(sc->asic_addr + ED_3COM_VPTR2, 0xff);
+ outb(sc->asic_addr + ED_3COM_VPTR1, 0xff);
+ outb(sc->asic_addr + ED_3COM_VPTR0, 0x00);
+
+ /* Zero memory and verify that it is clear. */
+ zero_isa(sc->mem_start, memsize);
+
+ for (i = 0; i < memsize; ++i)
+ if (ldb(sc->mem_start + i)) {
+ printf("%s: failed to clear shared memory at %x - check configuration\n",
+ sc->sc_dev.dv_xname, (int)(sc->mem_start + i));
+ return (0);
+ }
+
+ ia->ia_msize = memsize;
+ ia->ia_iosize = ED_3COM_IO_PORTS;
+ return (1);
+ }
+
+ /*
+ * Probe and vendor-specific initialization routine for NE1000/2000 boards.
+ */
+ int
+ isaed_probe_Novell(sc, cf, ia)
+ struct isaed_softc *sc;
+ struct cfdata *cf;
+ struct isa_attach_args *ia;
+ {
+ u_int memsize, n;
+ u_char romdata[16], isa16bit = 0, tmp;
+ static u_char test_pattern[32] = "THIS is A memory TEST pattern";
+ u_char test_buffer[32];
+
+ sc->asic_addr = ia->ia_iobase + ED_NOVELL_ASIC_OFFSET;
+ sc->nic_addr = ia->ia_iobase + ED_NOVELL_NIC_OFFSET;
+
+ /* XXX - do Novell-specific probe here */
+
+ /* Reset the board. */
+ #ifdef GWETHER
+ outb(sc->asic_addr + ED_NOVELL_RESET, 0);
+ delay(200);
+ #endif /* GWETHER */
+ tmp = inb(sc->asic_addr + ED_NOVELL_RESET);
+
+ /*
+ * I don't know if this is necessary; probably cruft leftover from
+ * Clarkson packet driver code. Doesn't do a thing on the boards I've
+ * tested. -DG [note that a outb(0x84, 0) seems to work here, and is
+ * non-invasive...but some boards don't seem to reset and I don't have
+ * complete documentation on what the 'right' thing to do is...so we do
+ * the invasive thing for now. Yuck.]
+ */
+ outb(sc->asic_addr + ED_NOVELL_RESET, tmp);
+ delay(5000);
+
+ /*
+ * This is needed because some NE clones apparently don't reset the NIC
+ * properly (or the NIC chip doesn't reset fully on power-up)
+ * XXX - this makes the probe invasive! ...Done against my better
+ * judgement. -DLG
+ */
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_PAGE_0 | ED_CR_STP);
+
+ delay(5000);
+
+ /* Make sure that we really have an 8390 based board. */
+ if (!isaed_probe_generic8390(sc))
+ return (0);
+
+ sc->vendor = ED_VENDOR_NOVELL;
+ sc->mem_shared = 0;
+ sc->cr_proto = ED_CR_RD2;
+ ia->ia_msize = 0;
+
+ /*
+ * Test the ability to read and write to the NIC memory. This has the
+ * side affect of determining if this is an NE1000 or an NE2000.
+ */
+
+ /*
+ * This prevents packets from being stored in the NIC memory when the
+ * readmem routine turns on the start bit in the CR.
+ */
+ NIC_PUT(sc, ED_P0_RCR, ED_RCR_MON);
+
+ /* Temporarily initialize DCR for byte operations. */
+ NIC_PUT(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_LS);
+
+ NIC_PUT(sc, ED_P0_PSTART, 8192 >> ED_PAGE_SHIFT);
+ NIC_PUT(sc, ED_P0_PSTOP, 16384 >> ED_PAGE_SHIFT);
+
+ sc->isa16bit = 0;
+
+ /*
+ * Write a test pattern in byte mode. If this fails, then there
+ * probably isn't any memory at 8k - which likely means that the board
+ * is an NE2000.
+ */
+ isaed_pio_writemem(sc, test_pattern, 8192, sizeof(test_pattern));
+ isaed_pio_readmem(sc, 8192, test_buffer, sizeof(test_pattern));
+
+ if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) {
+ /* not an NE1000 - try NE2000 */
+
+ NIC_PUT(sc, ED_P0_DCR,
+ ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS);
+ NIC_PUT(sc, ED_P0_PSTART, 16384 >> ED_PAGE_SHIFT);
+ NIC_PUT(sc, ED_P0_PSTOP, 32768 >> ED_PAGE_SHIFT);
+
+ sc->isa16bit = 1;
+
+ /*
+ * Write a test pattern in word mode. If this also fails, then
+ * we don't know what this board is.
+ */
+ isaed_pio_writemem(sc, test_pattern, 16384, sizeof(test_pattern));
+ isaed_pio_readmem(sc, 16384, test_buffer, sizeof(test_pattern));
+
+ if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)))
+ return (0); /* not an NE2000 either */
+
+ sc->type = ED_TYPE_NE2000;
+ sc->type_str = "NE2000";
+ } else {
+ sc->type = ED_TYPE_NE1000;
+ sc->type_str = "NE1000";
+ }
+
+ if (ia->ia_irq == IRQUNK) {
+ printf("%s: %s does not have soft configuration\n",
+ sc->sc_dev.dv_xname, sc->type_str);
+ return (0);
+ }
+
+ /* 8k of memory plus an additional 8k if 16-bit. */
+ memsize = 8192 + sc->isa16bit * 8192;
+
+ #if 0 /* probably not useful - NE boards only come two ways */
+ /* Allow kernel config file overrides. */
+ if (ia->ia_msize)
+ memsize = ia->ia_msize;
+ #endif
+
+ /* NIC memory doesn't start at zero on an NE board. */
+ /* The start address is tied to the bus width. */
+ sc->mem_start = (caddr_t)(8192 + sc->isa16bit * 8192);
+ sc->tx_page_start = memsize >> ED_PAGE_SHIFT;
+
+ #ifdef GWETHER
+ {
+ int x, i, mstart = 0;
+ char pbuf0[ED_PAGE_SIZE], pbuf[ED_PAGE_SIZE], tbuf[ED_PAGE_SIZE];
+
+ for (i = 0; i < ED_PAGE_SIZE; i++)
+ pbuf0[i] = 0;
+
+ /* Search for the start of RAM. */
+ for (x = 1; x < 256; x++) {
+ ed_pio_writemem(sc, pbuf0, x << ED_PAGE_SHIFT, ED_PAGE_SIZE);
+ ed_pio_readmem(sc, x << ED_PAGE_SHIFT, tbuf, ED_PAGE_SIZE);
+ if (!bcmp(pbuf0, tbuf, ED_PAGE_SIZE)) {
+ for (i = 0; i < ED_PAGE_SIZE; i++)
+ pbuf[i] = 255 - x;
+ ed_pio_writemem(sc, pbuf, x << ED_PAGE_SHIFT, ED_PAGE_SIZE);
+ ed_pio_readmem(sc, x << ED_PAGE_SHIFT, tbuf, ED_PAGE_SIZE);
+ if (!bcmp(pbuf, tbuf, ED_PAGE_SIZE)) {
+ mstart = x << ED_PAGE_SHIFT;
+ memsize = ED_PAGE_SIZE;
+ break;
+ }
+ }
+ }
+
+ if (mstart == 0) {
+ printf("%s: cannot find start of RAM\n",
+ sc->sc_dev.dv_xname);
+ return (0);
+ }
+
+ /* Search for the end of RAM. */
+ for (++x; x < 256; x++) {
+ ed_pio_writemem(sc, pbuf0, x << ED_PAGE_SHIFT, ED_PAGE_SIZE);
+ ed_pio_readmem(sc, x << ED_PAGE_SHIFT, tbuf, ED_PAGE_SIZE);
+ if (!bcmp(pbuf0, tbuf, ED_PAGE_SIZE)) {
+ for (i = 0; i < ED_PAGE_SIZE; i++)
+ pbuf[i] = 255 - x;
+ ed_pio_writemem(sc, pbuf, x << ED_PAGE_SHIFT, ED_PAGE_SIZE);
+ ed_pio_readmem(sc, x << ED_PAGE_SHIFT, tbuf, ED_PAGE_SIZE);
+ if (!bcmp(pbuf, tbuf, ED_PAGE_SIZE))
+ memsize += ED_PAGE_SIZE;
+ else
+ break;
+ } else
+ break;
+ }
+
+ printf("%s: RAM start %x, size %d\n",
+ sc->sc_dev.dv_xname, mstart, memsize);
+
+ sc->mem_start = (caddr_t)mstart;
+ sc->tx_page_start = mstart >> ED_PAGE_SHIFT;
+ }
+ #endif /* GWETHER */
+
+ sc->mem_size = memsize;
+ sc->mem_end = sc->mem_start + memsize;
+
+ /*
+ * Use one xmit buffer if < 16k, two buffers otherwise (if not told
+ * otherwise).
+ */
+ if ((memsize < 16384) || (cf->cf_flags & ED_FLAGS_NO_MULTI_BUFFERING))
+ sc->txb_cnt = 1;
+ else
+ sc->txb_cnt = 2;
+
+ sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
+ sc->rec_page_stop = sc->tx_page_start + (memsize >> ED_PAGE_SHIFT);
+
+ sc->mem_ring =
+ sc->mem_start + ((sc->txb_cnt * ED_TXBUF_SIZE) << ED_PAGE_SHIFT);
+
+ isaed_pio_readmem(sc, 0, romdata, 16);
+ for (n = 0; n < ETHER_ADDR_LEN; n++)
+ sc->sc_arpcom.ac_enaddr[n] = romdata[n*(sc->isa16bit+1)];
+
+ #ifdef GWETHER
+ if (sc->arpcom.ac_enaddr[2] == 0x86)
+ sc->type_str = "Gateway AT";
+ #endif /* GWETHER */
+
+ /* Clear any pending interrupts that might have occurred above. */
+ NIC_PUT(sc, ED_P0_ISR, 0xff);
+
+ ia->ia_iosize = ED_NOVELL_IO_PORTS;
+ return (1);
+ }
+
+ /*
+ * Install interface into kernel networking data structures.
+ */
+ void
+ isaedattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+ {
+ struct isaed_softc *sc = (void *)self;
+ struct isa_attach_args *ia = aux;
+ struct cfdata *cf = sc->sc_dev.dv_cfdata;
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+
+ /* Set interface to stopped condition (reset). */
+ isaedstop(sc);
+
+ /* Initialize ifnet structure. */
+ ifp->if_unit = sc->sc_dev.dv_unit;
+ ifp->if_name = isaedcd.cd_name;
+ ifp->if_start = isaedstart;
+ ifp->if_ioctl = isaedioctl;
+ ifp->if_watchdog = isaedwatchdog;
+ ifp->if_flags =
+ IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
+
+ /*
+ * Set default state for LINK0 flag (used to disable the tranceiver
+ * for AUI operation), based on compile-time config option.
+ */
+ switch (sc->vendor) {
+ case ED_VENDOR_3COM:
+ if (cf->cf_flags & ED_FLAGS_DISABLE_TRANCEIVER)
+ ifp->if_flags |= IFF_LINK0;
+ break;
+ case ED_VENDOR_WD_SMC:
+ if ((sc->type & ED_WD_SOFTCONFIG) == 0)
+ break;
+ if ((inb(sc->asic_addr + ED_WD_IRR) & ED_WD_IRR_OUT2) == 0)
+ ifp->if_flags |= IFF_LINK0;
+ break;
+ }
+
+ /* Attach the interface. */
+ if_attach(ifp);
+ ether_ifattach(ifp);
+
+ /* Print additional info when attached. */
+ printf(": address %s, ", ether_sprintf(sc->sc_arpcom.ac_enaddr));
+
+ if (sc->type_str)
+ printf("type %s ", sc->type_str);
+ else
+ printf("type unknown (0x%x) ", sc->type);
+
+ printf("%s", sc->isa16bit ? "(16-bit)" : "(8-bit)");
+
+ switch (sc->vendor) {
+ case ED_VENDOR_WD_SMC:
+ if ((sc->type & ED_WD_SOFTCONFIG) == 0)
+ break;
+ case ED_VENDOR_3COM:
+ if (ifp->if_flags & IFF_LINK0)
+ printf(" aui");
+ else
+ printf(" bnc");
+ break;
+ }
+
+ printf("\n");
+
+ #if NBPFILTER > 0
+ bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
+ #endif
+
+ sc->sc_ih = isa_intr_establish(ia->ia_irq, ISA_IST_EDGE, ISA_IPL_NET,
+ isaedintr, sc);
+ }
+
+ /*
+ * Reset interface.
+ */
+ void
+ isaedreset(sc)
+ struct isaed_softc *sc;
+ {
+ int s;
+
+ s = splimp();
+ isaedstop(sc);
+ isaedinit(sc);
+ splx(s);
+ }
+
+ /*
+ * Take interface offline.
+ */
+ void
+ isaedstop(sc)
+ struct isaed_softc *sc;
+ {
+ int n = 5000;
+
+ /* Stop everything on the interface, and select page 0 registers. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
+
+ /*
+ * Wait for interface to enter stopped state, but limit # of checks to
+ * 'n' (about 5ms). It shouldn't even take 5us on modern DS8390's, but
+ * just in case it's an old one.
+ */
+ while (((NIC_GET(sc, ED_P0_ISR) & ED_ISR_RST) == 0) && --n);
+ }
+
+ /*
+ * Device timeout/watchdog routine. Entered if the device neglects to generate
+ * an interrupt after a transmit has been started on it.
+ */
+ void
+ isaedwatchdog(unit)
+ int unit;
+ {
+ struct isaed_softc *sc = isaedcd.cd_devs[unit];
+
+ log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
+ ++sc->sc_arpcom.ac_if.if_oerrors;
+
+ isaedreset(sc);
+ }
+
+ /*
+ * Initialize device.
+ */
+ void
+ isaedinit(sc)
+ struct isaed_softc *sc;
+ {
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ int i;
+ u_char command;
+ u_long mcaf[2];
+
+ /*
+ * Initialize the NIC in the exact order outlined in the NS manual.
+ * This init procedure is "mandatory"...don't change what or when
+ * things happen.
+ */
+
+ /* Reset transmitter flags. */
+ ifp->if_timer = 0;
+
+ sc->txb_inuse = 0;
+ sc->txb_new = 0;
+ sc->txb_next_tx = 0;
+
+ /* Set interface for page 0, remote DMA complete, stopped. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
+
+ if (sc->isa16bit) {
+ /*
+ * Set FIFO threshold to 8, No auto-init Remote DMA, byte
+ * order=80x86, word-wide DMA xfers,
+ */
+ NIC_PUT(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_WTS | ED_DCR_LS);
+ } else {
+ /* Same as above, but byte-wide DMA xfers. */
+ NIC_PUT(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_LS);
+ }
+
+ /* Clear remote byte count registers. */
+ NIC_PUT(sc, ED_P0_RBCR0, 0);
+ NIC_PUT(sc, ED_P0_RBCR1, 0);
+
+ /* Tell RCR to do nothing for now. */
+ NIC_PUT(sc, ED_P0_RCR, ED_RCR_MON);
+
+ /* Place NIC in internal loopback mode. */
+ NIC_PUT(sc, ED_P0_TCR, ED_TCR_LB0);
+
+ /* Set lower bits of byte addressable framing to 0. */
+ if (sc->is790)
+ NIC_PUT(sc, 0x09, 0);
+
+ /* Initialize receive buffer ring. */
+ NIC_PUT(sc, ED_P0_BNRY, sc->rec_page_start);
+ NIC_PUT(sc, ED_P0_PSTART, sc->rec_page_start);
+ NIC_PUT(sc, ED_P0_PSTOP, sc->rec_page_stop);
+
+ /*
+ * Clear all interrupts. A '1' in each bit position clears the
+ * corresponding flag.
+ */
+ NIC_PUT(sc, ED_P0_ISR, 0xff);
+
+ /*
+ * Enable the following interrupts: receive/transmit complete,
+ * receive/transmit error, and Receiver OverWrite.
+ *
+ * Counter overflow and Remote DMA complete are *not* enabled.
+ */
+ NIC_PUT(sc, ED_P0_IMR,
+ ED_IMR_PRXE | ED_IMR_PTXE | ED_IMR_RXEE | ED_IMR_TXEE |
+ ED_IMR_OVWE);
+
+ /* Program command register for page 1. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP);
+
+ /* Copy out our station address. */
+ for (i = 0; i < ETHER_ADDR_LEN; ++i)
+ NIC_PUT(sc, ED_P1_PAR0 + i, sc->sc_arpcom.ac_enaddr[i]);
+
+ /* Set multicast filter on chip. */
+ isaed_getmcaf(&sc->sc_arpcom, mcaf);
+ for (i = 0; i < 8; i++)
+ NIC_PUT(sc, ED_P1_MAR0 + i, ((u_char *)mcaf)[i]);
+
+ /*
+ * Set current page pointer to one page after the boundary pointer, as
+ * recommended in the National manual.
+ */
+ sc->next_packet = sc->rec_page_start + 1;
+ NIC_PUT(sc, ED_P1_CURR, sc->next_packet);
+
+ /* Program command register for page 0. */
+ NIC_PUT(sc, ED_P1_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
+
+ i = ED_RCR_AB | ED_RCR_AM;
+ if (ifp->if_flags & IFF_PROMISC) {
+ /*
+ * Set promiscuous mode. Multicast filter was set earlier so
+ * that we should receive all multicast packets.
+ */
+ i |= ED_RCR_PRO | ED_RCR_AR | ED_RCR_SEP;
+ }
+ NIC_PUT(sc, ED_P0_RCR, i);
+
+ /* Take interface out of loopback. */
+ NIC_PUT(sc, ED_P0_TCR, 0);
+
+ /*
+ * If this is a 3Com board, the tranceiver must be software enabled
+ * (there is no settable hardware default).
+ */
+ switch (sc->vendor) {
+ u_char x;
+ case ED_VENDOR_3COM:
+ if (ifp->if_flags & IFF_LINK0)
+ outb(sc->asic_addr + ED_3COM_CR, 0);
+ else
+ outb(sc->asic_addr + ED_3COM_CR, ED_3COM_CR_XSEL);
+ break;
+ case ED_VENDOR_WD_SMC:
+ if ((sc->type & ED_WD_SOFTCONFIG) == 0)
+ break;
+ x = inb(sc->asic_addr + ED_WD_IRR);
+ if (ifp->if_flags & IFF_LINK0)
+ x &= ~ED_WD_IRR_OUT2;
+ else
+ x |= ED_WD_IRR_OUT2;
+ outb(sc->asic_addr + ED_WD_IRR, x);
+ break;
+ }
+
+ /* Fire up the interface. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
+
+ /* Set 'running' flag, and clear output active flag. */
+ ifp->if_flags |= IFF_RUNNING;
+ ifp->if_flags &= ~IFF_OACTIVE;
+
+ /* ...and attempt to start output. */
+ isaedstart(ifp);
+ }
+
+ /*
+ * This routine actually starts the transmission on the interface.
+ */
+ static inline void
+ isaed_xmit(sc)
+ struct isaed_softc *sc;
+ {
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ u_short len;
+
+ len = sc->txb_len[sc->txb_next_tx];
+
+ /* Set NIC for page 0 register access. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
+
+ /* Set TX buffer start page. */
+ NIC_PUT(sc, ED_P0_TPSR, sc->tx_page_start +
+ sc->txb_next_tx * ED_TXBUF_SIZE);
+
+ /* Set TX length. */
+ NIC_PUT(sc, ED_P0_TBCR0, len);
+ NIC_PUT(sc, ED_P0_TBCR1, len >> 8);
+
+ /* Set page 0, remote DMA complete, transmit packet, and *start*. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_TXP | ED_CR_STA);
+
+ /* Point to next transmit buffer slot and wrap if necessary. */
+ sc->txb_next_tx++;
+ if (sc->txb_next_tx == sc->txb_cnt)
+ sc->txb_next_tx = 0;
+
+ /* Set a timer just in case we never hear from the board again. */
+ ifp->if_timer = 2;
+ }
+
+ /*
+ * Start output on interface.
+ * We make two assumptions here:
+ * 1) that the current priority is set to splimp _before_ this code
+ * is called *and* is returned to the appropriate priority after
+ * return
+ * 2) that the IFF_OACTIVE flag is checked before this code is called
+ * (i.e. that the output part of the interface is idle)
+ */
+ void
+ isaedstart(ifp)
+ struct ifnet *ifp;
+ {
+ struct isaed_softc *sc = isaedcd.cd_devs[ifp->if_unit];
+ struct mbuf *m0, *m;
+ caddr_t buffer;
+ int len;
+
+ if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ return;
+
+ outloop:
+ /* See if there is room to put another packet in the buffer. */
+ if (sc->txb_inuse == sc->txb_cnt) {
+ /* No room. Indicate this to the outside world and exit. */
+ ifp->if_flags |= IFF_OACTIVE;
+ return;
+ }
+
+ IF_DEQUEUE(&ifp->if_snd, m0);
+ if (m0 == 0)
+ return;
+
+ /* We need to use m->m_pkthdr.len, so require the header */
+ if ((m0->m_flags & M_PKTHDR) == 0)
+ panic("edstart: no header mbuf");
+
+ #if NBPFILTER > 0
+ /* Tap off here if there is a BPF listener. */
+ if (ifp->if_bpf)
+ bpf_mtap(ifp->if_bpf, m0);
+ #endif
+
+ /* txb_new points to next open buffer slot. */
+ buffer = sc->mem_start + ((sc->txb_new * ED_TXBUF_SIZE) << ED_PAGE_SHIFT);
+
+ if (sc->mem_shared) {
+ /* Special case setup for 16 bit boards... */
+ switch (sc->vendor) {
+ /*
+ * For 16bit 3Com boards (which have 16k of memory), we
+ * have the xmit buffers in a different page of memory
+ * ('page 0') - so change pages.
+ */
+ case ED_VENDOR_3COM:
+ if (sc->isa16bit)
+ outb(sc->asic_addr + ED_3COM_GACFR,
+ ED_3COM_GACFR_RSEL);
+ break;
+ /*
+ * Enable 16bit access to shared memory on WD/SMC
+ * boards.
+ */
+ case ED_VENDOR_WD_SMC:
+ if (sc->isa16bit)
+ outb(sc->asic_addr + ED_WD_LAAR,
+ sc->wd_laar_proto | ED_WD_LAAR_M16EN);
+ outb(sc->asic_addr + ED_WD_MSR,
+ sc->wd_msr_proto | ED_WD_MSR_MENB);
+ (void) inb(0x84);
+ (void) inb(0x84);
+ break;
+ }
+
+ for (len = 0; m; m = m->m_next) {
+ copy_to_isa(mtod(m, caddr_t), buffer, m->m_len);
+ buffer += m->m_len;
+ len += m->m_len;
+ }
+
+ /* Restore previous shared memory access. */
+ switch (sc->vendor) {
+ case ED_VENDOR_3COM:
+ if (sc->isa16bit)
+ outb(sc->asic_addr + ED_3COM_GACFR,
+ ED_3COM_GACFR_RSEL | ED_3COM_GACFR_MBS0);
+ break;
+ case ED_VENDOR_WD_SMC:
+ outb(sc->asic_addr + ED_WD_MSR,
+ sc->wd_msr_proto);
+ if (sc->isa16bit)
+ outb(sc->asic_addr + ED_WD_LAAR,
+ sc->wd_laar_proto);
+ (void) inb(0x84);
+ (void) inb(0x84);
+ break;
+ }
+ } else
+ len = isaed_pio_write_mbufs(sc, m0, (long)buffer);
+
+ m_freem(m0);
+ sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN);
+ #ifdef DDB
+ if (sc->next_packet < sc->rec_page_start || sc->next_packet >= sc->rec_page_stop)
+ Debugger();
+ #endif
+
+ /* Start the first packet transmitting. */
+ if (sc->txb_inuse == 0)
+ isaed_xmit(sc);
+
+ /* Point to next buffer slot and wrap if necessary. */
+ if (++sc->txb_new == sc->txb_cnt)
+ sc->txb_new = 0;
+ sc->txb_inuse++;
+
+ /* Loop back to the top to possibly buffer more packets. */
+ goto outloop;
+ }
+
+ /*
+ * Ethernet interface receiver interrupt.
+ */
+ static inline void
+ isaed_rint(sc)
+ struct isaed_softc *sc;
+ {
+ u_char boundary, current;
+ u_short len;
+ u_char nlen;
+ struct ed_ring packet_hdr;
+ caddr_t packet_ptr;
+
+ loop:
+ #ifdef DDB
+ if (sc->next_packet < sc->rec_page_start || sc->next_packet >= sc->rec_page_stop)
+ Debugger();
+ #endif
+ /* Set NIC to page 1 registers to get 'current' pointer. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA);
+
+ /*
+ * 'sc->next_packet' is the logical beginning of the ring-buffer - i.e.
+ * it points to where new data has been buffered. The 'CURR' (current)
+ * register points to the logical end of the ring-buffer - i.e. it
+ * points to where additional new data will be added. We loop here
+ * until the logical beginning equals the logical end (or in other
+ * words, until the ring-buffer is empty).
+ */
+ current = NIC_GET(sc, ED_P1_CURR);
+ if (sc->next_packet == current)
+ return;
+
+ /* Set NIC to page 0 registers to update boundary register. */
+ NIC_PUT(sc, ED_P1_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
+
+ do {
+ /* Get pointer to this buffer's header structure. */
+ packet_ptr = sc->mem_ring +
+ ((sc->next_packet - sc->rec_page_start) << ED_PAGE_SHIFT);
+
+ /*
+ * The byte count includes a 4 byte header that was added by
+ * the NIC.
+ */
+ if (sc->mem_shared)
+ copy_from_isa(packet_ptr, &packet_hdr,
+ sizeof(packet_hdr));
+ else
+ isaed_pio_readmem(sc, (long)packet_ptr,
+ (caddr_t) &packet_hdr, sizeof(packet_hdr));
+ len = itohs(packet_hdr.count);
+ #ifdef ISAED_DEBUG
+ if (isaeddebug) {
+ int i;
+ u_char buf[64];
+
+ if (sc->mem_shared)
+ copy_from_isa(((u_char *)packet_ptr + sizeof(struct ed_ring)), buf, 64);
+ else
+ isaed_pio_readmem(sc, (long)packet_ptr + sizeof(struct ed_ring),
+ (caddr_t) buf, 64);
+ printf("pkt hdr len %d hdr %02x %02x %02x %02x pkt len %d\n",
+ sizeof(packet_hdr), ((u_char *)&packet_hdr)[0],
+ ((u_char *)&packet_hdr)[1], ((u_char *)&packet_hdr)[2],
+ ((u_char *)&packet_hdr)[3], len);
+ for (i = 0; i < 64; i++)
+ printf("%02x%c", buf[i], i % 16 == 15 ? '\n' : ' ');
+ }
+ #endif
+
+ /*
+ * Try do deal with old, buggy chips that sometimes duplicate
+ * the low byte of the length into the high byte. We do this
+ * by simply ignoring the high byte of the length and always
+ * recalculating it.
+ *
+ * NOTE: sc->next_packet is pointing at the current packet.
+ */
+ if (packet_hdr.next_packet >= sc->next_packet)
+ nlen = (packet_hdr.next_packet - sc->next_packet);
+ else
+ nlen = ((packet_hdr.next_packet - sc->rec_page_start) +
+ (sc->rec_page_stop - sc->next_packet));
+ --nlen;
+ if ((len & ED_PAGE_MASK) + sizeof(packet_hdr) > ED_PAGE_SIZE)
+ --nlen;
+ len = (len & ED_PAGE_MASK) | (nlen << ED_PAGE_SHIFT);
+ #ifdef DIAGNOSTIC
+ if (len != itohs(packet_hdr.count)) {
+ printf("%s: length does not match next packet pointer\n",
+ sc->sc_dev.dv_xname);
+ printf("%s: len %04x nlen %04x start %02x first %02x curr %02x next %02x stop %02x\n",
+ sc->sc_dev.dv_xname, itohs(packet_hdr.count), len,
+ sc->rec_page_start, sc->next_packet, current,
+ packet_hdr.next_packet, sc->rec_page_stop);
+ }
+ #endif
+
+ /*
+ * Be fairly liberal about what we allow as a "reasonable"
+ * length so that a [crufty] packet will make it to BPF (and
+ * can thus be analyzed). Note that all that is really
+ * important is that we have a length that will fit into one
+ * mbuf cluster or less; the upper layer protocols can then
+ * figure out the length from their own length field(s).
+ */
+ if (len <= (MCLBYTES > ETHER_MAX_LEN ?
+ MCLBYTES : ETHER_MAX_LEN) &&
+ packet_hdr.next_packet >= sc->rec_page_start &&
+ packet_hdr.next_packet < sc->rec_page_stop) {
+ /* Go get packet. */
+ isaedread(sc, packet_ptr + sizeof(struct ed_ring),
+ len - sizeof(struct ed_ring));
+ } else {
+ /* Really BAD. The ring pointers are corrupted. */
+ log(LOG_ERR,
+ "%s: NIC memory corrupt - invalid packet length %d or pkt link %d [%d-%d)\n",
+ sc->sc_dev.dv_xname, len, packet_hdr.next_packet,
+ sc->rec_page_start, sc->rec_page_stop);
+ ++sc->sc_arpcom.ac_if.if_ierrors;
+ isaedreset(sc);
+ return;
+ }
+
+
+ sc->next_packet = packet_hdr.next_packet;
+ #ifdef DDB
+ if (sc->next_packet < sc->rec_page_start || sc->next_packet >= sc->rec_page_stop)
+ Debugger();
+ #endif
+
+ /*
+ * Update NIC boundary pointer - being careful to keep it one
+ * buffer behind (as recommended by NS databook).
+ */
+ boundary = sc->next_packet - 1;
+ if (boundary < sc->rec_page_start)
+ boundary = sc->rec_page_stop - 1;
+ NIC_PUT(sc, ED_P0_BNRY, boundary);
+ } while (sc->next_packet != current);
+
+ goto loop;
+ }
+
+ /* Ethernet interface interrupt processor. */
+ int
+ isaedintr(arg)
+ void *arg;
+ {
+ struct isaed_softc *sc = arg;
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ u_char isr;
+
+ /* Set NIC to page 0 registers. */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
+
+ isr = NIC_GET(sc, ED_P0_ISR);
+ if (!isr)
+ return (0);
+ /* Loop until there are no more new interrupts. */
+ for (;;) {
+ #ifdef DDB
+ if (sc->next_packet < sc->rec_page_start || sc->next_packet >= sc->rec_page_stop)
+ Debugger();
+ #endif
+ /*
+ * Reset all the bits that we are 'acknowledging' by writing a
+ * '1' to each bit position that was set.
+ * (Writing a '1' *clears* the bit.)
+ */
+ NIC_PUT(sc, ED_P0_ISR, isr);
+
+ /*
+ * Handle transmitter interrupts. Handle these first because
+ * the receiver will reset the board under some conditions.
+ */
+ if (isr & (ED_ISR_PTX | ED_ISR_TXE)) {
+ u_char collisions = NIC_GET(sc, ED_P0_NCR) & 0x0f;
+
+ /*
+ * Check for transmit error. If a TX completed with an
+ * error, we end up throwing the packet away. Really
+ * the only error that is possible is excessive
+ * collisions, and in this case it is best to allow the
+ * automatic mechanisms of TCP to backoff the flow. Of
+ * course, with UDP we're screwed, but this is expected
+ * when a network is heavily loaded.
+ */
+ (void) NIC_GET(sc, ED_P0_TSR);
+ if (isr & ED_ISR_TXE) {
+ /*
+ * Excessive collisions (16).
+ */
+ if ((NIC_GET(sc, ED_P0_TSR) & ED_TSR_ABT)
+ && (collisions == 0)) {
+ /*
+ * When collisions total 16, the P0_NCR
+ * will indicate 0, and the TSR_ABT is
+ * set.
+ */
+ collisions = 16;
+ }
+
+ /* Update output errors counter. */
+ ++ifp->if_oerrors;
+ } else {
+ /*
+ * Update total number of successfully
+ * transmitted packets.
+ */
+ ++ifp->if_opackets;
+ }
+
+ /* Done with the buffer. */
+ sc->txb_inuse--;
+
+ /* Clear watchdog timer. */
+ ifp->if_timer = 0;
+ ifp->if_flags &= ~IFF_OACTIVE;
+
+ /*
+ * Add in total number of collisions on last
+ * transmission.
+ */
+ ifp->if_collisions += collisions;
+
+ /*
+ * Decrement buffer in-use count if not zero (can only
+ * be zero if a transmitter interrupt occured while not
+ * actually transmitting).
+ * If data is ready to transmit, start it transmitting,
+ * otherwise defer until after handling receiver.
+ */
+ if (sc->txb_inuse > 0)
+ isaed_xmit(sc);
+ }
+
+ /* Handle receiver interrupts. */
+ if (isr & (ED_ISR_PRX | ED_ISR_RXE | ED_ISR_OVW)) {
+ /*
+ * Overwrite warning. In order to make sure that a
+ * lockup of the local DMA hasn't occurred, we reset
+ * and re-init the NIC. The NSC manual suggests only a
+ * partial reset/re-init is necessary - but some chips
+ * seem to want more. The DMA lockup has been seen
+ * only with early rev chips - Methinks this bug was
+ * fixed in later revs. -DG
+ */
+ if (isr & ED_ISR_OVW) {
+ ++ifp->if_ierrors;
+ #ifdef DIAGNOSTIC
+ log(LOG_WARNING,
+ "%s: warning - receiver ring buffer overrun\n",
+ sc->sc_dev.dv_xname);
+ #endif
+ /* Stop/reset/re-init NIC. */
+ isaedreset(sc);
+ } else {
+ /*
+ * Receiver Error. One or more of: CRC error,
+ * frame alignment error FIFO overrun, or
+ * missed packet.
+ */
+ if (isr & ED_ISR_RXE) {
+ ++ifp->if_ierrors;
+ #ifdef ISAED_DEBUG
+ if (isaeddebug)
+ printf("%s: receive error %x\n",
+ sc->sc_dev.dv_xname,
+ NIC_GET(sc, ED_P0_RSR));
+ #endif
+ }
+
+ /*
+ * Go get the packet(s).
+ * XXX - Doing this on an error is dubious
+ * because there shouldn't be any data to get
+ * (we've configured the interface to not
+ * accept packets with errors).
+ */
+
+ /*
+ * Enable 16bit access to shared memory first
+ * on WD/SMC boards.
+ */
+ if (sc->vendor == ED_VENDOR_WD_SMC) {
+ if (sc->isa16bit)
+ outb(sc->asic_addr + ED_WD_LAAR,
+ sc->wd_laar_proto | ED_WD_LAAR_M16EN);
+ outb(sc->asic_addr + ED_WD_MSR,
+ sc->wd_msr_proto | ED_WD_MSR_MENB);
+ (void) inb(0x84);
+ (void) inb(0x84);
+ }
+
+ isaed_rint(sc);
+
+ /* Disable 16-bit access. */
+ if (sc->vendor == ED_VENDOR_WD_SMC) {
+ outb(sc->asic_addr + ED_WD_MSR,
+ sc->wd_msr_proto);
+ if (sc->isa16bit)
+ outb(sc->asic_addr + ED_WD_LAAR,
+ sc->wd_laar_proto);
+ (void) inb(0x84);
+ (void) inb(0x84);
+ }
+ }
+ }
+
+ /*
+ * If it looks like the transmitter can take more data, attempt
+ * to start output on the interface. This is done after
+ * handling the receiver to give the receiver priority.
+ */
+ isaedstart(ifp);
+
+ /*
+ * Return NIC CR to standard state: page 0, remote DMA
+ * complete, start (toggling the TXP bit off, even if was just
+ * set in the transmit routine, is *okay* - it is 'edge'
+ * triggered from low to high).
+ */
+ NIC_PUT(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
+
+ /*
+ * If the Network Talley Counters overflow, read them to reset
+ * them. It appears that old 8390's won't clear the ISR flag
+ * otherwise - resulting in an infinite loop.
+ */
+ if (isr & ED_ISR_CNT) {
+ (void) NIC_GET(sc, ED_P0_CNTR0);
+ (void) NIC_GET(sc, ED_P0_CNTR1);
+ (void) NIC_GET(sc, ED_P0_CNTR2);
+ }
+
+ isr = NIC_GET(sc, ED_P0_ISR);
+ if (!isr)
+ return (1);
+ }
+ }
+
+ /*
+ * Process an ioctl request. This code needs some work - it looks pretty ugly.
+ */
+ int
+ isaedioctl(ifp, cmd, data)
+ register struct ifnet *ifp;
+ u_long cmd;
+ caddr_t data;
+ {
+ struct isaed_softc *sc = isaedcd.cd_devs[ifp->if_unit];
+ register struct ifaddr *ifa = (struct ifaddr *)data;
+ struct ifreq *ifr = (struct ifreq *)data;
+ int s, error = 0;
+
+ s = splimp();
+
+ switch (cmd) {
+
+ case SIOCSIFADDR:
+ ifp->if_flags |= IFF_UP;
+
+ switch (ifa->ifa_addr->sa_family) {
+ #ifdef INET
+ case AF_INET:
+ isaedinit(sc);
+ arp_ifinit(&sc->sc_arpcom, ifa);
+ break;
+ #endif
+ #ifdef NS
+ /* XXX - This code is probably wrong. */
+ case AF_NS:
+ {
+ register struct ns_addr *ina = &IA_SNS(ifa)->sns_addr;
+
+ if (ns_nullhost(*ina))
+ ina->x_host =
+ *(union ns_host *)(sc->sc_arpcom.ac_enaddr);
+ else
+ copy(ina->x_host.c_host,
+ sc->sc_arpcom.ac_enaddr,
+ sizeof(sc->sc_arpcom.ac_enaddr));
+ /* Set new address. */
+ isaedinit(sc);
+ break;
+ }
+ #endif
+ default:
+ isaedinit(sc);
+ break;
+ }
+ break;
+
+ case SIOCSIFFLAGS:
+ if ((ifp->if_flags & IFF_UP) == 0 &&
+ (ifp->if_flags & IFF_RUNNING) != 0) {
+ /*
+ * If interface is marked down and it is running, then
+ * stop it.
+ */
+ isaedstop(sc);
+ ifp->if_flags &= ~IFF_RUNNING;
+ } else if ((ifp->if_flags & IFF_UP) != 0 &&
+ (ifp->if_flags & IFF_RUNNING) == 0) {
+ /*
+ * If interface is marked up and it is stopped, then
+ * start it.
+ */
+ isaedinit(sc);
+ } else {
+ /*
+ * Reset the interface to pick up changes in any other
+ * flags that affect hardware registers.
+ */
+ isaedstop(sc);
+ isaedinit(sc);
+ }
+ break;
+
+ case SIOCADDMULTI:
+ case SIOCDELMULTI:
+ /* Update our multicast list. */
+ error = (cmd == SIOCADDMULTI) ?
+ ether_addmulti(ifr, &sc->sc_arpcom) :
+ ether_delmulti(ifr, &sc->sc_arpcom);
+
+ if (error == ENETRESET) {
+ /*
+ * Multicast list has changed; set the hardware filter
+ * accordingly.
+ */
+ isaedstop(sc); /* XXX for ds_setmcaf? */
+ isaedinit(sc);
+ error = 0;
+ }
+ break;
+
+ default:
+ error = EINVAL;
+ break;
+ }
+
+ splx(s);
+ return (error);
+ }
+
+ /*
+ * Retreive packet from shared memory and send to the next level up via
+ * ether_input(). If there is a BPF listener, give a copy to BPF, too.
+ */
+ void
+ isaedread(sc, buf, len)
+ struct isaed_softc *sc;
+ caddr_t buf;
+ int len;
+ {
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct mbuf *m;
+ struct ether_header *eh;
+
+ /* Pull packet off interface. */
+ m = isaedget(sc, buf, len);
+ if (m == 0) {
+ ifp->if_ierrors++;
+ return;
+ }
+
+ ifp->if_ipackets++;
+
+ /* We assume that the header fit entirely in one mbuf. */
+ eh = mtod(m, struct ether_header *);
+
+ #if NBPFILTER > 0
+ /*
+ * Check if there's a BPF listener on this interface.
+ * If so, hand off the raw packet to BPF.
+ */
+ if (ifp->if_bpf) {
+ bpf_mtap(ifp->if_bpf, m);
+
+ /*
+ * Note that the interface cannot be in promiscuous mode if
+ * there are no BPF listeners. And if we are in promiscuous
+ * mode, we have to check if this packet is really ours.
+ */
+ if ((ifp->if_flags & IFF_PROMISC) &&
+ (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
+ bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr,
+ sizeof(eh->ether_dhost)) != 0) {
+ m_freem(m);
+ return;
+ }
+ }
+ #endif
+
+ /* We assume that the header fit entirely in one mbuf. */
+ m_adj(m, sizeof(struct ether_header));
+ ether_input(ifp, eh, m);
+ }
+
+ /*
+ * Supporting routines.
+ */
+
+ /*
+ * Given a NIC memory source address and a host memory destination address,
+ * copy 'amount' from NIC to host using Programmed I/O. The 'amount' is
+ * rounded up to a word - okay as long as mbufs are word sized.
+ * This routine is currently Novell-specific.
+ */
+ void
+ isaed_pio_readmem(sc, src, dst, amount)
+ struct isaed_softc *sc;
+ u_short src;
+ caddr_t dst;
+ u_short amount;
+ {
+ /* Select page 0 registers. */
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_PAGE_0 | ED_CR_STA);
+
+ /* Round up to a word. */
+ if (amount & 1)
+ ++amount;
+
+ /* Set up DMA byte count. */
+ NIC_PUT(sc, ED_P0_RBCR0, amount);
+ NIC_PUT(sc, ED_P0_RBCR1, amount >> 8);
+
+ /* Set up source address in NIC mem. */
+ NIC_PUT(sc, ED_P0_RSAR0, src);
+ NIC_PUT(sc, ED_P0_RSAR1, src >> 8);
+
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD0 | ED_CR_PAGE_0 | ED_CR_STA);
+
+ if (sc->isa16bit)
+ insw(sc->asic_addr + ED_NOVELL_DATA, dst, amount / 2);
+ else
+ insb(sc->asic_addr + ED_NOVELL_DATA, dst, amount);
+ }
+
+ /*
+ * Stripped down routine for writing a linear buffer to NIC memory. Only used
+ * in the probe routine to test the memory. 'len' must be even.
+ */
+ void
+ isaed_pio_writemem(sc, src, dst, len)
+ struct isaed_softc *sc;
+ caddr_t src;
+ u_short dst;
+ u_short len;
+ {
+ int maxwait = 100; /* about 120us */
+
+ /* Select page 0 registers. */
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_PAGE_0 | ED_CR_STA);
+
+ /* Reset remote DMA complete flag. */
+ NIC_PUT(sc, ED_P0_ISR, ED_ISR_RDC);
+
+ /* Set up DMA byte count. */
+ NIC_PUT(sc, ED_P0_RBCR0, len);
+ NIC_PUT(sc, ED_P0_RBCR1, len >> 8);
+
+ /* Set up destination address in NIC mem. */
+ NIC_PUT(sc, ED_P0_RSAR0, dst);
+ NIC_PUT(sc, ED_P0_RSAR1, dst >> 8);
+
+ /* Set remote DMA write. */
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD1 | ED_CR_PAGE_0 | ED_CR_STA);
+
+ if (sc->isa16bit)
+ outsw(sc->asic_addr + ED_NOVELL_DATA, src, len / 2);
+ else
+ outsb(sc->asic_addr + ED_NOVELL_DATA, src, len);
+
+ /*
+ * Wait for remote DMA complete. This is necessary because on the
+ * transmit side, data is handled internally by the NIC in bursts and
+ * we can't start another remote DMA until this one completes. Not
+ * waiting causes really bad things to happen - like the NIC
+ * irrecoverably jamming the ISA bus.
+ */
+ while (((NIC_GET(sc, ED_P0_ISR) & ED_ISR_RDC) != ED_ISR_RDC) && --maxwait);
+ }
+
+ /*
+ * Write an mbuf chain to the destination NIC memory address using programmed
+ * I/O.
+ */
+ u_short
+ isaed_pio_write_mbufs(sc, m, dst)
+ struct isaed_softc *sc;
+ struct mbuf *m;
+ u_short dst;
+ {
+ u_short len;
+ struct mbuf *mp;
+ int maxwait = 100; /* about 120us */
+
+ len = m->m_pkthdr.len;
+
+ /* Select page 0 registers. */
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_PAGE_0 | ED_CR_STA);
+
+ /* Reset remote DMA complete flag. */
+ NIC_PUT(sc, ED_P0_ISR, ED_ISR_RDC);
+
+ /* Set up DMA byte count. */
+ NIC_PUT(sc, ED_P0_RBCR0, len);
+ NIC_PUT(sc, ED_P0_RBCR1, len >> 8);
+
+ /* Set up destination address in NIC mem. */
+ NIC_PUT(sc, ED_P0_RSAR0, dst);
+ NIC_PUT(sc, ED_P0_RSAR1, dst >> 8);
+
+ /* Set remote DMA write. */
+ NIC_PUT(sc, ED_P0_CR, ED_CR_RD1 | ED_CR_PAGE_0 | ED_CR_STA);
+
+ /*
+ * Transfer the mbuf chain to the NIC memory.
+ * 16-bit cards require that data be transferred as words, and only
+ * words, so that case requires some extra code to patch over
+ * odd-length mbufs.
+ */
+ if (!sc->isa16bit) {
+ /* NE1000s are easy. */
+ for (; m != 0; m = m->m_next) {
+ if (m->m_len) {
+ outsb(sc->asic_addr + ED_NOVELL_DATA,
+ mtod(m, u_char *), m->m_len);
+ }
+ }
+ } else {
+ /* NE2000s are a bit trickier. */
+ u_char *data, savebyte[2];
+ int len, wantbyte;
+
+ wantbyte = 0;
+ for (; m != 0; m = m->m_next) {
+ len = m->m_len;
+ if (len == 0)
+ continue;
+ data = mtod(m, u_char *);
+ /* Finish the last word. */
+ if (wantbyte) {
+ savebyte[1] = *data;
+ outw(sc->asic_addr + ED_NOVELL_DATA,
+ *(u_short *)savebyte);
+ data++;
+ len--;
+ wantbyte = 0;
+ }
+ /* Output contiguous words. */
+ if (len > 1)
+ outsw(sc->asic_addr + ED_NOVELL_DATA,
+ data, len >> 1);
+ /* Save last byte, if necessary. */
+ if (len & 1) {
+ data += len & ~1;
+ savebyte[0] = *data;
+ wantbyte = 1;
+ }
+ }
+
+ if (wantbyte) {
+ savebyte[1] = 0;
+ outw(sc->asic_addr + ED_NOVELL_DATA,
+ *(u_short *)savebyte);
+ }
+ }
+
+ /*
+ * Wait for remote DMA complete. This is necessary because on the
+ * transmit side, data is handled internally by the NIC in bursts and
+ * we can't start another remote DMA until this one completes. Not
+ * waiting causes really bad things to happen - like the NIC
+ * irrecoverably jamming the ISA bus.
+ */
+ while (((NIC_GET(sc, ED_P0_ISR) & ED_ISR_RDC) != ED_ISR_RDC) && --maxwait);
+
+ if (!maxwait) {
+ log(LOG_WARNING,
+ "%s: remote transmit DMA failed to complete\n",
+ sc->sc_dev.dv_xname);
+ isaedreset(sc);
+ }
+
+ return (len);
+ }
+
+ /*
+ * Given a source and destination address, copy 'amount' of a packet from the
+ * ring buffer into a linear destination buffer. Takes into account ring-wrap.
+ */
+ static inline caddr_t
+ isaed_ring_copy(sc, src, dst, amount)
+ struct isaed_softc *sc;
+ caddr_t src, dst;
+ u_short amount;
+ {
+ u_short tmp_amount;
+
+ /* Does copy wrap to lower addr in ring buffer? */
+ if (src + amount > sc->mem_end) {
+ tmp_amount = sc->mem_end - src;
+
+ /* Copy amount up to end of NIC memory. */
+ if (sc->mem_shared)
+ copy_from_isa(src, dst, tmp_amount);
+ else
+ isaed_pio_readmem(sc, (long)src, dst, tmp_amount);
+
+ amount -= tmp_amount;
+ src = sc->mem_ring;
+ dst += tmp_amount;
+ }
+
+ if (sc->mem_shared)
+ copy_from_isa(src, dst, amount);
+ else
+ isaed_pio_readmem(sc, (long)src, dst, amount);
+
+ return (src + amount);
+ }
+
+ /*
+ * Copy data from receive buffer to end of mbuf chain allocate additional mbufs
+ * as needed. Return pointer to last mbuf in chain.
+ * sc = isaed info (softc)
+ * src = pointer in isaed ring buffer
+ * dst = pointer to last mbuf in mbuf chain to copy to
+ * amount = amount of data to copy
+ */
+ struct mbuf *
+ isaedget(sc, src, total_len)
+ struct isaed_softc *sc;
+ caddr_t src;
+ u_short total_len;
+ {
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ struct mbuf *top, **mp, *m;
+ int len;
+
+ MGETHDR(m, M_DONTWAIT, MT_DATA);
+ if (m == 0)
+ return 0;
+ m->m_pkthdr.rcvif = ifp;
+ m->m_pkthdr.len = total_len;
+ len = MHLEN;
+ top = 0;
+ mp = ⊤
+
+ while (total_len > 0) {
+ if (top) {
+ MGET(m, M_DONTWAIT, MT_DATA);
+ if (m == 0) {
+ m_freem(top);
+ return 0;
+ }
+ len = MLEN;
+ }
+ if (total_len >= MINCLSIZE) {
+ MCLGET(m, M_DONTWAIT);
+ if (m->m_flags & M_EXT)
+ len = MCLBYTES;
+ }
+ m->m_len = len = min(total_len, len);
+ src = isaed_ring_copy(sc, src, mtod(m, caddr_t), len);
+ total_len -= len;
+ *mp = m;
+ mp = &m->m_next;
+ }
+
+ return top;
+ }
+
+ /*
+ * Compute the multicast address filter from the list of multicast addresses we
+ * need to listen to.
+ */
+ void
+ isaed_getmcaf(ac, af)
+ struct arpcom *ac;
+ u_long *af;
+ {
+ struct ifnet *ifp = &ac->ac_if;
+ struct ether_multi *enm;
+ register u_char *cp, c;
+ register u_long crc;
+ register int i, len;
+ struct ether_multistep step;
+
+ /*
+ * Set up multicast address filter by passing all multicast addresses
+ * through a crc generator, and then using the high order 6 bits as an
+ * index into the 64 bit logical address filter. The high order bit
+ * selects the word, while the rest of the bits select the bit within
+ * the word.
+ */
+
+ if (ifp->if_flags & IFF_PROMISC) {
+ ifp->if_flags |= IFF_ALLMULTI;
+ af[0] = af[1] = 0xffffffff;
+ return;
+ }
+
+ af[0] = af[1] = 0;
+ ETHER_FIRST_MULTI(step, ac, enm);
+ while (enm != NULL) {
+ if (bcmp(enm->enm_addrlo, enm->enm_addrhi,
+ sizeof(enm->enm_addrlo)) != 0) {
+ /*
+ * We must listen to a range of multicast addresses.
+ * For now, just accept all multicasts, rather than
+ * trying to set only those filter bits needed to match
+ * the range. (At this time, the only use of address
+ * ranges is for IP multicast routing, for which the
+ * range is big enough to require all bits set.)
+ */
+ ifp->if_flags |= IFF_ALLMULTI;
+ af[0] = af[1] = 0xffffffff;
+ return;
+ }
+
+ cp = enm->enm_addrlo;
+ crc = 0xffffffff;
+ for (len = sizeof(enm->enm_addrlo); --len >= 0;) {
+ c = *cp++;
+ for (i = 8; --i >= 0;) {
+ if (((crc & 0x80000000) ? 1 : 0) ^ (c & 0x01)) {
+ crc <<= 1;
+ crc ^= 0x04c11db6 | 1;
+ } else
+ crc <<= 1;
+ c >>= 1;
+ }
+ }
+ /* Just want the 6 most significant bits. */
+ crc >>= 26;
+
+ /* Turn on the corresponding bit in the filter. */
+ af[crc >> 5] |= 1 << ((crc & 0x1f) ^ 0);
+
+ ETHER_NEXT_MULTI(step, enm);
+ }
+ ifp->if_flags &= ~IFF_ALLMULTI;
+ }
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/if_isaedreg.h
***************
*** 0 ****
--- 1,398 ----
+ /* $NetBSD: if_isaedreg.h,v 1.12 1994/10/27 04:17:23 cgd Exp $ */
+
+ /*
+ * National Semiconductor DS8390 NIC register definitions.
+ *
+ * Copyright (C) 1993, David Greenman. This software may be used, modified,
+ * copied, distributed, and sold, in both source and binary form provided that
+ * the above copyright and these terms are retained. Under no circumstances is
+ * the author responsible for the proper functioning of this software, nor does
+ * the author assume any responsibility for damages incurred with its use.
+ */
+
+ /*
+ * Vendor types
+ */
+ #define ED_VENDOR_WD_SMC 0x00 /* Western Digital/SMC */
+ #define ED_VENDOR_3COM 0x01 /* 3Com */
+ #define ED_VENDOR_NOVELL 0x02 /* Novell */
+
+ /*
+ * Compile-time config flags
+ */
+ /*
+ * This sets the default for enabling/disablng the tranceiver.
+ */
+ #define ED_FLAGS_DISABLE_TRANCEIVER 0x0001
+
+ /*
+ * This forces the board to be used in 8/16-bit mode even if it autoconfigs
+ * differently.
+ */
+ #define ED_FLAGS_FORCE_8BIT_MODE 0x0002
+ #define ED_FLAGS_FORCE_16BIT_MODE 0x0004
+
+ /*
+ * This disables the use of double transmit buffers.
+ */
+ #define ED_FLAGS_NO_MULTI_BUFFERING 0x0008
+
+ /*
+ * This forces all operations with the NIC memory to use Programmed I/O (i.e.
+ * not via shared memory).
+ */
+ #define ED_FLAGS_FORCE_PIO 0x0010
+
+ /*
+ * Definitions for Western digital/SMC WD80x3 series ASIC
+ */
+ /*
+ * Memory Select Register (MSR)
+ */
+ #define ED_WD_MSR 0
+
+ /* next three definitions for Toshiba */
+ #define ED_WD_MSR_POW 0x02 /* 0 = power save, 1 = normal (R/W) */
+ #define ED_WD_MSR_BSY 0x04 /* gate array busy (R) */
+ #define ED_WD_MSR_LEN 0x20 /* 0 = 16-bit, 1 = 8-bit (R/W) */
+
+ #define ED_WD_MSR_ADDR 0x3f /* Memory decode bits 18-13 */
+ #define ED_WD_MSR_MENB 0x40 /* Memory enable */
+ #define ED_WD_MSR_RST 0x80 /* Reset board */
+
+ /*
+ * Interface Configuration Register (ICR)
+ */
+ #define ED_WD_ICR 1
+
+ #define ED_WD_ICR_16BIT 0x01 /* 16-bit interface */
+ #define ED_WD_ICR_OAR 0x02 /* select register (0=BIO 1=EAR) */
+ #define ED_WD_ICR_IR2 0x04 /* high order bit of encoded IRQ */
+ #define ED_WD_ICR_MSZ 0x08 /* memory size (0=8k 1=32k) */
+ #define ED_WD_ICR_RLA 0x10 /* recall LAN address */
+ #define ED_WD_ICR_RX7 0x20 /* recall all but i/o and LAN address */
+ #define ED_WD_ICR_RIO 0x40 /* recall i/o address */
+ #define ED_WD_ICR_STO 0x80 /* store to non-volatile memory */
+ #ifdef TOSH_ETHER
+ #define ED_WD_ICR_MEM 0xe0 /* shared mem address A15-A13 (R/W) */
+ #define ED_WD_ICR_MSZ1 0x0f /* memory size, 0x08 = 64K, 0x04 = 32K,
+ 0x02 = 16K, 0x01 = 8K */
+ /* 64K can only be used if mem address
+ above 1MB */
+ /* IAR holds address A23-A16 (R/W) */
+ #endif
+
+ /*
+ * IO Address Register (IAR)
+ */
+ #define ED_WD_IAR 2
+
+ /*
+ * EEROM Address Register
+ */
+ #define ED_WD_EAR 3
+
+ /*
+ * Interrupt Request Register (IRR)
+ */
+ #define ED_WD_IRR 4
+
+ #define ED_WD_IRR_0WS 0x01 /* use 0 wait-states on 8 bit bus */
+ #define ED_WD_IRR_OUT1 0x02 /* WD83C584 pin 1 output */
+ #define ED_WD_IRR_OUT2 0x04 /* WD83C584 pin 2 output */
+ #define ED_WD_IRR_OUT3 0x08 /* WD83C584 pin 3 output */
+ #define ED_WD_IRR_FLASH 0x10 /* Flash RAM is in the ROM socket */
+
+ /*
+ * The three bits of the encoded IRQ are decoded as follows:
+ *
+ * IR2 IR1 IR0 IRQ
+ * 0 0 0 2/9
+ * 0 0 1 3
+ * 0 1 0 5
+ * 0 1 1 7
+ * 1 0 0 10
+ * 1 0 1 11
+ * 1 1 0 15
+ * 1 1 1 4
+ */
+ #define ED_WD_IRR_IR0 0x20 /* bit 0 of encoded IRQ */
+ #define ED_WD_IRR_IR1 0x40 /* bit 1 of encoded IRQ */
+ #define ED_WD_IRR_IEN 0x80 /* Interrupt enable */
+
+ /*
+ * LA Address Register (LAAR)
+ */
+ #define ED_WD_LAAR 5
+
+ #define ED_WD_LAAR_ADDRHI 0x1f /* bits 23-19 of RAM address */
+ #define ED_WD_LAAR_0WS16 0x20 /* enable 0 wait-states on 16 bit bus */
+ #define ED_WD_LAAR_L16EN 0x40 /* enable 16-bit operation */
+ #define ED_WD_LAAR_M16EN 0x80 /* enable 16-bit memory access */
+
+ /* i/o base offset to station address/card-ID PROM */
+ #define ED_WD_PROM 8
+
+ /*
+ * 83C790 specific registers
+ */
+ /*
+ * Hardware Support Register (HWR) ('790)
+ */
+ #define ED_WD790_HWR 4
+
+ #define ED_WD790_HWR_RST 0x10 /* hardware reset */
+ #define ED_WD790_HWR_LPRM 0x40 /* LAN PROM select */
+ #define ED_WD790_HWR_SWH 0x80 /* switch register set */
+
+ /*
+ * ICR790 Interrupt Control Register for the 83C790
+ */
+ #define ED_WD790_ICR 6
+
+ #define ED_WD790_ICR_EIL 0x01 /* enable interrupts */
+
+ /*
+ * General Control Register (GCR)
+ * Eanbled with SWH bit == 1 in HWR register
+ */
+ #define ED_WD790_GCR 0x0d
+
+ #define ED_WD790_GCR_IR0 0x04 /* bit 0 of encoded IRQ */
+ #define ED_WD790_GCR_IR1 0x08 /* bit 1 of encoded IRQ */
+ #define ED_WD790_GCR_ZWSEN 0x20 /* zero wait state enable */
+ #define ED_WD790_GCR_IR2 0x40 /* bit 2 of encoded IRQ */
+ /*
+ * The three bits of the encoded IRQ are decoded as follows:
+ *
+ * IR2 IR1 IR0 IRQ
+ * 0 0 0 none
+ * 0 0 1 9
+ * 0 1 0 3
+ * 0 1 1 5
+ * 1 0 0 7
+ * 1 0 1 10
+ * 1 1 0 11
+ * 1 1 1 15
+ */
+
+ /* i/o base offset to CARD ID */
+ #define ED_WD_CARD_ID ED_WD_PROM+6
+
+ /* Board type codes in card ID */
+ #define ED_TYPE_WD8003S 0x02
+ #define ED_TYPE_WD8003E 0x03
+ #define ED_TYPE_WD8013EBT 0x05
+ #define ED_TYPE_TOSHIBA1 0x11 /* named PCETA1 */
+ #define ED_TYPE_TOSHIBA2 0x12 /* named PCETA2 */
+ #define ED_TYPE_TOSHIBA3 0x13 /* named PCETB */
+ #define ED_TYPE_TOSHIBA4 0x14 /* named PCETC */
+ #define ED_TYPE_WD8003W 0x24
+ #define ED_TYPE_WD8003EB 0x25
+ #define ED_TYPE_WD8013W 0x26
+ #define ED_TYPE_WD8013EP 0x27
+ #define ED_TYPE_WD8013WC 0x28
+ #define ED_TYPE_WD8013EPC 0x29
+ #define ED_TYPE_SMC8216T 0x2a
+ #define ED_TYPE_SMC8216C 0x2b
+ #define ED_TYPE_WD8013EBP 0x2c
+
+ /* Bit definitions in card ID */
+ #define ED_WD_REV_MASK 0x1f /* Revision mask */
+ #define ED_WD_SOFTCONFIG 0x20 /* Soft config */
+ #define ED_WD_LARGERAM 0x40 /* Large RAM */
+ #define ED_MICROCHANEL 0x80 /* Microchannel bus (vs. isa) */
+
+ /*
+ * Checksum total. All 8 bytes in station address PROM will add up to this.
+ */
+ #ifdef TOSH_ETHER
+ #define ED_WD_ROM_CHECKSUM_TOTAL 0xA5
+ #else
+ #define ED_WD_ROM_CHECKSUM_TOTAL 0xFF
+ #endif
+
+ #define ED_WD_NIC_OFFSET 0x10 /* I/O base offset to NIC */
+ #define ED_WD_ASIC_OFFSET 0 /* I/O base offset to ASIC */
+ #define ED_WD_IO_PORTS 32 /* # of i/o addresses used */
+
+ #define ED_WD_PAGE_OFFSET 0 /* page offset for NIC access to mem */
+
+ /*
+ * Definitions for 3Com 3c503
+ */
+ #define ED_3COM_NIC_OFFSET 0
+ #define ED_3COM_ASIC_OFFSET 0x400 /* offset to nic i/o regs */
+
+ /*
+ * XXX - The I/O address range is fragmented in the 3c503; this is the
+ * number of regs at iobase.
+ */
+ #define ED_3COM_IO_PORTS 16 /* # of i/o addresses used */
+
+ /* tx memory starts in second bank on 8bit cards */
+ #define ED_3COM_TX_PAGE_OFFSET_8BIT 0x20
+
+ /* tx memory starts in first bank on 16bit cards */
+ #define ED_3COM_TX_PAGE_OFFSET_16BIT 0x0
+
+ /* ...and rx memory starts in second bank */
+ #define ED_3COM_RX_PAGE_OFFSET_16BIT 0x20
+
+
+ /*
+ * Page Start Register. Must match PSTART in NIC.
+ */
+ #define ED_3COM_PSTR 0
+
+ /*
+ * Page Stop Register. Must match PSTOP in NIC.
+ */
+ #define ED_3COM_PSPR 1
+
+ /*
+ * DrQ Timer Register. Determines number of bytes to be transfered during a
+ * DMA burst.
+ */
+ #define ED_3COM_DQTR 2
+
+ /*
+ * Base Configuration Register. Read-only register which contains the
+ * board-configured I/O base address of the adapter. Bit encoded.
+ */
+ #define ED_3COM_BCFR 3
+
+ /*
+ * EPROM Configuration Register. Read-only register which contains the
+ * board-configured memory base address. Bit encoded.
+ */
+ #define ED_3COM_PCFR 4
+
+ /*
+ * GA Configuration Register. Gate-Array Configuration Register.
+ *
+ * mbs2 mbs1 mbs0 start address
+ * 0 0 0 0x0000
+ * 0 0 1 0x2000
+ * 0 1 0 0x4000
+ * 0 1 1 0x6000
+ *
+ * Note that with adapters with only 8K, the setting for 0x2000 must always be
+ * used.
+ */
+ #define ED_3COM_GACFR 5
+
+ #define ED_3COM_GACFR_MBS0 0x01
+ #define ED_3COM_GACFR_MBS1 0x02
+ #define ED_3COM_GACFR_MBS2 0x04
+
+ #define ED_3COM_GACFR_RSEL 0x08 /* enable shared memory */
+ #define ED_3COM_GACFR_TEST 0x10 /* for GA testing */
+ #define ED_3COM_GACFR_OWS 0x20 /* select 0WS access to GA */
+ #define ED_3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */
+ #define ED_3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */
+
+ /*
+ * Control Register. Miscellaneous control functions.
+ */
+ #define ED_3COM_CR 6
+
+ #define ED_3COM_CR_RST 0x01 /* Reset GA and NIC */
+ #define ED_3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */
+ #define ED_3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */
+ #define ED_3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */
+ #define ED_3COM_CR_SHARE 0x10 /* select interrupt sharing option */
+ #define ED_3COM_CR_DBSEL 0x20 /* Double buffer select */
+ #define ED_3COM_CR_DDIR 0x40 /* DMA direction select */
+ #define ED_3COM_CR_START 0x80 /* Start DMA controller */
+
+ /*
+ * Status Register. Miscellaneous status information.
+ */
+ #define ED_3COM_STREG 7
+
+ #define ED_3COM_STREG_REV 0x07 /* GA revision */
+ #define ED_3COM_STREG_DIP 0x08 /* DMA in progress */
+ #define ED_3COM_STREG_DTC 0x10 /* DMA terminal count */
+ #define ED_3COM_STREG_OFLW 0x20 /* Overflow */
+ #define ED_3COM_STREG_UFLW 0x40 /* Underflow */
+ #define ED_3COM_STREG_DPRDY 0x80 /* Data port ready */
+
+ /*
+ * Interrupt/DMA Configuration Register
+ */
+ #define ED_3COM_IDCFR 8
+
+ #define ED_3COM_IDCFR_DRQ 0x07 /* DMA request */
+ #define ED_3COM_IDCFR_UNUSED 0x08 /* not used */
+ #if 0
+ #define ED_3COM_IDCFR_IRQ 0xF0 /* Interrupt request */
+ #else
+ #define ED_3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */
+ #define ED_3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */
+ #define ED_3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */
+ #define ED_3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */
+ #endif
+
+ /*
+ * DMA Address Register MSB
+ */
+ #define ED_3COM_DAMSB 9
+
+ /*
+ * DMA Address Register LSB
+ */
+ #define ED_3COM_DALSB 0x0a
+
+ /*
+ * Vector Pointer Register 2
+ */
+ #define ED_3COM_VPTR2 0x0b
+
+ /*
+ * Vector Pointer Register 1
+ */
+ #define ED_3COM_VPTR1 0x0c
+
+ /*
+ * Vector Pointer Register 0
+ */
+ #define ED_3COM_VPTR0 0x0d
+
+ /*
+ * Register File Access MSB
+ */
+ #define ED_3COM_RFMSB 0x0e
+
+ /*
+ * Register File Access LSB
+ */
+ #define ED_3COM_RFLSB 0x0f
+
+ /*
+ * Definitions for Novell NE1000/2000 boards
+ */
+
+ /*
+ * Board type codes
+ */
+ #define ED_TYPE_NE1000 0x01
+ #define ED_TYPE_NE2000 0x02
+
+ /*
+ * Register offsets/total
+ */
+ #define ED_NOVELL_NIC_OFFSET 0x00
+ #define ED_NOVELL_ASIC_OFFSET 0x10
+ #define ED_NOVELL_IO_PORTS 32
+
+ /*
+ * Remote DMA data register; for reading or writing to the NIC mem via
+ * programmed I/O (offset from ASIC base).
+ */
+ #define ED_NOVELL_DATA 0x00
+
+ /*
+ * Reset register; reading from this register causes a board reset.
+ */
+ #define ED_NOVELL_RESET 0x0f
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/isa_intr.h
***************
*** 0 ****
--- 1,58 ----
+ /* $NetBSD: isa_intr.h,v 1.1 1995/08/02 14:44:57 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1995 Niklas Hallqvist.
+ * All rights reserved.
+ *
+ * Copyright (c) 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Authors: Chris G. Demetriou, Niklas Hallqvist.
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+ /* Prototypes for ISA-ish I/O interrupt functions. */
+
+ /*
+ * XXX
+ * XXX THIS WILL LIKELY HAVE TO BE COMPLETELY CHANGED.
+ * XXX
+ */
+
+ struct isa_intr_fcns {
+ void (*isa_intr_setup) __P((void));
+
+ void *(*isa_intr_establish) __P((int irq, isa_intrtype type,
+ isa_intrlevel level, int (*ih_fun)(void *), void *ih_arg));
+ void (*isa_intr_disestablish) __P((void *handler));
+
+ void (*isa_iointr) __P((void *framep, int vec));
+ };
+
+ /*
+ * Global which tells which set of functions are correct
+ * for this machine.
+ */
+ struct isa_intr_fcns *isa_intr_fcns;
+
+ extern struct isa_intr_fcns ggbus_intr_fcns;
+ extern struct isa_intr_fcns cross_intr_fcns;
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/isa_machdep.c
***************
*** 0 ****
--- 1,162 ----
+ /* $NetBSD: isa_machdep.c,v 1.1 1995/08/02 14:10:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1995 Niklas Hallqvist
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Niklas Hallqvist.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #include <sys/param.h>
+ #include <sys/device.h>
+ #include <sys/malloc.h>
+
+ #include <dev/isa/isavar.h>
+
+ #include <machine/pio.h>
+
+ #include <amiga/amiga/device.h>
+ #include <amiga/isa/isa_intr.h>
+
+ void isaattach __P((struct device *, struct device *, void *));
+ int isamatch __P((struct device *, void *, void *));
+
+ /*
+ * After careful thought about this issue I decided that allowing only
+ * one isabus configured into a system would be sufficient. I'm not
+ * lazy, I did the original design with possibilities of multiple ISA
+ * busses, but that made porting of existing drivers a bit harder and
+ * error-prone, as well as I had to write obfuscated code. This
+ * solution is more in the spirit of KISS. --niklas@appli.se
+ */
+ struct isa_link *isa;
+ int isadebug = 0;
+
+ struct cfdriver isacd = {
+ NULL, "isa", isamatch, isaattach,
+ DV_DULL, sizeof(struct device), 1
+ };
+
+ int
+ isamatch(parent, cfdata, aux)
+ struct device *parent;
+ void *cfdata, *aux;
+ {
+ struct cfdata *cf = cfdata;
+
+ #ifdef DEBUG
+ if (isadebug)
+ printf(" isamatch");
+ #endif
+
+ /* See if the unit number is valid. */
+ if (cf->cf_unit > 0)
+ return (0);
+
+ return (1);
+ }
+
+ void
+ isaattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+ {
+ struct isa_softc *sc = (struct isa_softc *)self;
+
+ isa = (struct isa_link *)aux;
+
+ printf("\n");
+
+ TAILQ_INIT (&sc->sc_subdevs);
+
+ config_scan(isascan, self);
+ }
+
+ void *
+ isa_intr_establish(intr, type, level, ih_fun, ih_arg)
+ int intr;
+ isa_intrtype type;
+ isa_intrlevel level;
+ int (*ih_fun)(void *);
+ void *ih_arg;
+ {
+ return (*isa_intr_fcns->isa_intr_establish)(intr, type, level,
+ ih_fun, ih_arg);
+ }
+
+ void
+ isa_intr_disestablish(handler)
+ void *handler;
+ {
+ (*isa_intr_fcns->isa_intr_disestablish)(handler);
+ }
+
+ void
+ isa_outsb(port, addr, cnt)
+ int port;
+ void *addr;
+ int cnt;
+ {
+ u_int8_t *p = addr;
+
+ while (cnt--)
+ outb(port, *p++);
+ }
+
+ void
+ isa_insb(port, addr, cnt)
+ int port;
+ void *addr;
+ int cnt;
+ {
+ u_int8_t *p = addr;
+
+ while (cnt--)
+ *p++ = inb(port);
+ }
+
+ void
+ isa_outsw(port, addr, cnt)
+ int port;
+ void *addr;
+ int cnt;
+ {
+ u_int16_t *p = addr;
+
+ while (cnt--)
+ outw(port, *p++);
+ }
+
+ void
+ isa_insw(port, addr, cnt)
+ int port;
+ void *addr;
+ int cnt;
+ {
+ u_int16_t *p = addr;
+
+ while (cnt--)
+ *p++ = inw(port);
+ }
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/isa_machdep.h
***************
*** 0 ****
--- 1,192 ----
+ /* $NetBSD: isa_machdep.h,v 1.1 1995/07/21 23:07:17 niklas Exp $ */
+
+ /*
+ * Copyright (c) 1995 Niklas Hallqvist
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Niklas Hallqvist.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ #ifndef _ISA_MACHDEP_H_
+ #define _ISA_MACHDEP_H_
+
+ #include <machine/endian.h>
+
+ void isa_insb __P((int port, void *addr, int));
+ void isa_outsb __P((int port, void *addr, int));
+ void isa_insw __P((int port, void *addr, int));
+ void isa_outsw __P((int port, void *addr, int));
+
+ /*
+ * The link between the ISA device drivers and the bridgecard used.
+ */
+ struct isa_link {
+ struct device *il_dev;
+ void (*il_stb)(struct device *, int, u_char);
+ u_char (*il_ldb)(struct device *, int);
+ void (*il_stw)(struct device *, int, u_short);
+ u_short (*il_ldw)(struct device *, int);
+ };
+
+ extern struct isa_link *isa;
+ extern struct cfdriver isacd;
+
+ static __inline void
+ stb(addr, val)
+ int addr;
+ u_char val;
+ {
+ (*isa->il_stb)(isa->il_dev, addr, val);
+ }
+
+ static __inline u_char
+ ldb(addr)
+ int addr;
+ {
+ return (*isa->il_ldb)(isa->il_dev, addr);
+ }
+
+ static __inline void
+ stw(addr, val)
+ int addr;
+ u_short val;
+ {
+ (*isa->il_stw)(isa->il_dev, addr, val);
+ }
+
+ static __inline u_short
+ ldw(addr)
+ int addr;
+ {
+ return (*isa->il_ldw)(isa->il_dev, addr);
+ }
+
+ /*
+ * Should these be out-of-line instead? If so, move them to isa.c!
+ * How about unaligned word accesses? Does the '020 allow them? If not
+ * we have to do odd to even moves and vice versa bytewise instead of
+ * wordwise.
+ */
+ static __inline void
+ copy_from_isa (void *from, void *to, int cnt)
+ {
+ int a = (int)from;
+
+ if (a & 1 && cnt) {
+ *(u_char *)to = ldb(a++);
+ to = ((u_char *)to) + 1;
+ cnt--;
+ }
+ /* Maybe use Duff's device here... */
+ while (cnt > 1) {
+ *(u_short *)to = ldw(a);
+ a += sizeof(u_short);
+ to = ((u_short *)to) + 1;
+ cnt -= 2;
+ }
+ if (cnt)
+ *(u_char *)to = ldb(a);
+ }
+
+ static __inline void
+ copy_to_isa (const void *from, void *to, int cnt)
+ {
+ int a = (int)to;
+
+ if (a & 1 && cnt) {
+ stb(a++, *(u_char *)from);
+ from = ((u_char *)from) + 1;
+ cnt--;
+ }
+ /* Maybe use Duff's device here... */
+ while (cnt > 1) {
+ stw(a, *(u_short *)from);
+ a += sizeof(u_short);
+ from = ((u_short *)from) + 1;
+ cnt -= 2;
+ }
+ if (cnt)
+ stb(a, *(u_char *)from);
+ }
+
+ static __inline void
+ zero_isa (void *addr, int cnt)
+ {
+ int a = (int)addr;
+
+ if (a & 1 && cnt) {
+ stb(a++, 0);
+ cnt--;
+ }
+ /* Maybe use Duff's device here... */
+ while (cnt > 1) {
+ stw(a, 0);
+ a += sizeof(u_short);
+ cnt -= 2;
+ }
+ if (cnt)
+ stb(a, 0);
+ }
+
+ /*
+ * These inlines convert shorts from/to isa (intel) byte order to host
+ * byte-order. I know both are exactly equal, but I think it make code
+ * more readable to have separate names for them as they indeed have
+ * distinctive functionalities.
+ */
+ static __inline u_short
+ swap(u_short x)
+ {
+ __asm("rolw #8,%0" : "=r" (x) : "0" (x));
+ return x;
+ }
+
+ static __inline u_short
+ itohs(u_short x)
+ {
+ #if BYTE_ORDER == LITTLE_ENDIAN
+ return x;
+ #else
+ return swap(x);
+ #endif
+ }
+
+ static __inline u_short
+ htois(u_short x)
+ {
+ #if BYTE_ORDER == LITTLE_ENDIAN
+ return x;
+ #else
+ return swap(x);
+ #endif
+ }
+
+ /*
+ * Given a physical address in the "hole",
+ * return a kernel virtual address.
+ */
+ #define ISA_HOLE_VADDR(p) ((caddr_t)p)
+
+ #endif
*** /dev/null
--- NetBSD/src/sys/arch/amiga/isa/isareg.h
***************
*** 0 ****
--- 1,211 ----
+ /* $NetBSD: isareg.h,v 1.4 1994/10/27 04:17:49 cgd Exp $ */
+
+ /*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)isa.h 5.7 (Berkeley) 5/9/91
+ */
+
+ /*
+ * ISA Bus conventions
+ */
+
+ #ifndef LOCORE
+ #include <sys/cdefs.h>
+
+ unsigned char rtcin __P((int));
+ void sysbeep __P((int, int));
+ unsigned kbd_8042cmd __P((int));
+ #endif /* !LOCORE */
+
+
+ /*
+ * Input / Output Port Assignments
+ */
+
+ #ifndef IO_BEGIN
+ #define IO_ISABEGIN 0x000 /* 0x000 - Beginning of I/O Registers */
+
+ /* CPU Board */
+ #define IO_DMA1 0x000 /* 8237A DMA Controller #1 */
+ #define IO_ICU1 0x020 /* 8259A Interrupt Controller #1 */
+ #define IO_PMP1 0x026 /* 82347 Power Management Peripheral */
+ #define IO_TIMER1 0x040 /* 8253 Timer #1 */
+ #define IO_TIMER2 0x048 /* 8253 Timer #2 (EISA only) */
+ #define IO_KBD 0x060 /* 8042 Keyboard */
+ #define IO_PPI 0x061 /* Programmable Peripheral Interface */
+ #define IO_RTC 0x070 /* RTC */
+ #define IO_NMI IO_RTC /* NMI Control */
+ #define IO_DMAPG 0x080 /* DMA Page Registers */
+ #define IO_ICU2 0x0A0 /* 8259A Interrupt Controller #2 */
+ #define IO_DMA2 0x0C0 /* 8237A DMA Controller #2 */
+ #define IO_NPX 0x0F0 /* Numeric Coprocessor */
+
+ /* Cards */
+ /* 0x100 - 0x16F Open */
+
+ #define IO_WD2 0x170 /* Secondary Fixed Disk Controller */
+ #define IO_PMP2 0x178 /* 82347 Power Management Peripheral */
+
+ /* 0x17A - 0x1EF Open */
+
+ #define IO_WD1 0x1f0 /* Primary Fixed Disk Controller */
+ #define IO_GAME 0x200 /* Game Controller */
+
+ /* 0x208 - 0x237 Open */
+
+ #define IO_BMS2 0x238 /* secondary InPort Bus Mouse */
+ #define IO_BMS1 0x23c /* primary InPort Bus Mouse */
+
+ /* 0x240 - 0x277 Open */
+
+ #define IO_LPT2 0x278 /* Parallel Port #2 */
+
+ /* 0x280 - 0x2E7 Open */
+
+ #define IO_COM4 0x2e8 /* COM4 i/o address */
+
+ /* 0x2F0 - 0x2F7 Open */
+
+ #define IO_COM2 0x2f8 /* COM2 i/o address */
+
+ /* 0x300 - 0x32F Open */
+
+ #define IO_BT0 0x330 /* bustek 742a default addr. */
+ #define IO_AHA0 0x330 /* adaptec 1542 default addr. */
+ #define IO_UHA0 0x330 /* ultrastore 14f default addr. */
+ #define IO_BT1 0x334 /* bustek 742a default addr. */
+ #define IO_AHA1 0x334 /* adaptec 1542 default addr. */
+
+ /* 0x338 - 0x34F Open */
+
+ #define IO_WDS 0x350 /* WD7000 scsi */
+
+ /* 0x354 - 0x36F Open */
+
+ #define IO_FD2 0x370 /* secondary base i/o address */
+ #define IO_LPT1 0x378 /* Parallel Port #1 */
+
+ /* 0x380 - 0x3AF Open */
+
+ #define IO_MDA 0x3B0 /* Monochome Adapter */
+ #define IO_LPT3 0x3BC /* Monochome Adapter Printer Port */
+ #define IO_VGA 0x3C0 /* E/VGA Ports */
+ #define IO_CGA 0x3D0 /* CGA Ports */
+
+ /* 0x3E0 - 0x3E7 Open */
+
+ #define IO_COM3 0x3e8 /* COM3 i/o address */
+ #define IO_FD1 0x3f0 /* primary base i/o address */
+ #define IO_COM1 0x3f8 /* COM1 i/o address */
+
+ #define IO_ISAEND 0x3FF /* - 0x3FF End of I/O Registers */
+ #endif /* !IO_ISABEGIN */
+
+ /*
+ * Input / Output Port Sizes - these are from several sources, and tend
+ * to be the larger of what was found, ie COM ports can be 4, but some
+ * boards do not fully decode the address, thus 8 ports are used.
+ */
+
+ #ifndef IO_ISASIZES
+ #define IO_ISASIZES
+
+ #define IO_COMSIZE 8 /* 8250, 16X50 com controllers (*/
+ #define IO_CGASIZE 16 /* CGA controllers */
+ #define IO_DMASIZE 16 /* 8237 DMA controllers */
+ #define IO_DPGSIZE 32 /* 74LS612 DMA page reisters */
+ #define IO_FDCSIZE 8 /* Nec765 floppy controllers */
+ #define IO_WDCSIZE 8 /* WD compatible disk controller */
+ #define IO_GAMSIZE 16 /* AT compatible game controller */
+ #define IO_ICUSIZE 16 /* 8259A interrupt controllers */
+ #define IO_KBDSIZE 16 /* 8042 Keyboard controllers */
+ #define IO_LPTSIZE 8 /* LPT controllers, some use onl */
+ #define IO_MDASIZE 16 /* Monochrome display controller */
+ #define IO_RTCSIZE 16 /* CMOS real time clock, NMI con */
+ #define IO_TMRSIZE 16 /* 8253 programmable timers */
+ #define IO_NPXSIZE 16 /* 80387/80487 NPX registers */
+ #define IO_VGASIZE 16 /* VGA controllers */
+ #define IO_PMPSIZE 2 /* 82347 Power Management Peripheral */
+ #endif /* !IO_ISASIZES */
+
+ /*
+ * Input / Output Memory Physical Addresses
+ */
+
+ #ifndef IOM_BEGIN
+ #define IOM_BEGIN 0x0a0000 /* Start of I/O Memory "hole" */
+ #define IOM_END 0x100000 /* End of I/O Memory "hole" */
+ #define IOM_SIZE (IOM_END - IOM_BEGIN)
+ #endif /* !IOM_BEGIN */
+
+ /*
+ * RAM Physical Address Space (ignoring the above mentioned "hole")
+ */
+
+ #ifndef RAM_BEGIN
+ #define RAM_BEGIN 0x0000000 /* Start of RAM Memory */
+ #define RAM_END 0x1000000 /* End of RAM Memory */
+ #define RAM_SIZE (RAM_END - RAM_BEGIN)
+ #endif /* !RAM_BEGIN */
+
+ /*
+ * Oddball Physical Memory Addresses
+ */
+ #ifndef COMPAQ_RAMRELOC
+ #define COMPAQ_RAMRELOC 0x80c00000 /* Compaq RAM relocation/diag */
+ #define COMPAQ_RAMSETUP 0x80c00002 /* Compaq RAM setup */
+ #define WEITEK_FPU 0xC0000000 /* WTL 2167 */
+ #define CYRIX_EMC 0xC0000000 /* Cyrix EMC */
+ #endif /* !COMPAQ_RAMRELOC */
+
+ /* stuff that used to be in pccons.c */
+ #define MONO_BASE 0x3B4
+ #define MONO_BUF (KERNBASE + 0xB0000)
+ #define CGA_BASE 0x3D4
+ #define CGA_BUF (KERNBASE + 0xB8000)
+ #define IOPHYSMEM 0xA0000
+
+ /*
+ * size of dma bounce buffer in pages
+ * - currently 1 page per channel
+ */
+ #ifndef DMA_BOUNCE
+ #define DMA_BOUNCE 8
+ #endif
+
+ #ifndef LOCORE
+ extern vm_offset_t isaphysmem;
+ #endif /* !LOCORE */
*** old-NetBSD/src/sys/arch/amiga/stand/videomode/videomode.c
--- NetBSD/src/sys/arch/amiga/stand/videomode/videomode.c
***************
*** 1,6 ****
--- 1,7 ----
/* $NetBSD: videomode.c,v 1.3 1994/10/26 02:07:14 cgd Exp $ */
#include <sys/types.h>
+ #include <sys/device.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include "../../dev/grfioctl.h"
*** /dev/null
--- NetBSD/src/sys/arch/i386/conf/NETTAN
***************
*** 0 ****
--- 1,173 ----
+ # $NetBSD: GENERIC,v 1.19 1995/07/24 03:33:12 mycroft Exp $
+ #
+ # GENERIC -- everything that's currently supported
+ #
+
+ machine i386 # architecture, used by config; REQUIRED
+
+ options I386_CPU # CPU classes; at least one is REQUIRED
+ options I486_CPU
+ options I586_CPU
+ options MATH_EMULATE # floating point emulation
+
+ #options DUMMY_NOPS # speed hack; recommanded
+ options XSERVER,UCONSOLE
+ options INSECURE # insecure; allow /dev/mem writing for X
+ options MACHINE_NONCONTIG
+
+ maxusers 32 # estimated number of users
+ options TIMEZONE=0 # time zone to adjust RTC time by
+ options DST=0 # daylight savings time used by RTC
+
+ options SWAPPAGER # paging; REQUIRED
+ options VNODEPAGER # mmap() of files
+ options DEVPAGER # mmap() of devices
+
+ options DDB # in-kernel debugger
+ #makeoptions DEBUG="-g" # compile full symbol table
+ options DIAGNOSTIC # internally consistency checks
+ options KTRACE # system call tracing, a la ktrace(1)
+
+ options SYSVMSG # System V-like message queues
+ options SYSVSEM # System V-like semaphores
+ options SYSVSHM # System V-like memory sharing
+ #options SHMMAXPGS=1024 # 1024 pages is the default
+
+ options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8,
+ options COMPAT_09 # NetBSD 0.9,
+ options COMPAT_10 # NetBSD 1.0,
+ options COMPAT_43 # and 4.3BSD
+ options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
+
+ options COMPAT_SVR4 # binary compatibility with SVR4
+ options COMPAT_IBCS2 # binary compatibility with SCO and ISC
+ options COMPAT_LINUX # binary compatibility with Linux
+
+ options USER_LDT # user-settable LDT; used by WINE
+ options LKM # loadable kernel modules
+
+ options FFS # UFS
+ options QUOTA # UFS quotas
+ options LFS # log-structured file system
+ options MFS # memory file system
+
+ options NFSCLIENT # Network File System client
+ options NFSSERVER # Network File System server
+
+ options CD9660 # ISO 9660 + Rock Ridge file system
+ options MSDOSFS # MS-DOS file system
+ options FDESC # /dev/fd
+ options FIFO # FIFOs; RECOMMENDED
+ options KERNFS # /kern
+ options NULLFS # loopback file system
+ options PORTAL # ?
+ options PROCFS # /proc
+ options UMAPFS # NULLFS + uid and gid remapping
+ options UNION # union file system
+
+ #options GATEWAY # packet forwarding
+ options INET # IP + ICMP + TCP + UDP
+ options NS # XNS
+ options ISO,TPIP # OSI
+ options EON # OSI tunneling over IP
+ options CCITT,LLC,HDLC # X.25
+
+ config netbsd swap generic
+ options GENERIC
+
+ isa0 at root
+ pci0 at root
+
+ npx0 at isa? port 0xf0 irq 13 # math coprocessor
+
+ pc0 at isa? port 0x60 irq 1 # generic PC console device
+ #vt0 at isa? port 0x60 irq 1
+
+ com0 at isa? port 0x3f8 irq 4 # standard PC serial ports
+ com1 at isa? port 0x2f8 irq 3
+ com2 at isa? port 0x3e8 irq 5
+ #com3 at isa? port 0x2e8 irq 9
+ #ast0 at isa? port 0x1a0 irq 5 # AST 4-port serial cards
+ #com* at ast? slave ? flags 1
+ #boca0 at isa? port 0x100 irq 5 # BOCA 8-port serial cards
+ #com* at boca? slave ?
+ #rtfps0 at isa? port 0x1230 irq 10 # RT 4-port serial cards
+ #com* at rtfps? slave ?
+
+ #cy0 at isa? ...
+
+ lpt0 at isa? port 0x378 irq 7 # standard PC parallel ports
+ lpt1 at isa? port 0x278
+ lpt2 at isa? port 0x3bc
+
+ lms0 at isa? port 0x23c irq 5 # Logitech bus mouse
+ lms1 at isa? port 0x238 irq 5
+ mms0 at isa? port 0x23c irq 5 # Microsoft InPort mouse
+ mms1 at isa? port 0x238 irq 5
+ #pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary port mouse
+
+ aha0 at isa? port 0x330 irq ? drq ? # Adaptec 154[02] SCSI controllers
+ aha1 at isa? port 0x334 irq ? drq ? # Adaptec 154[02] SCSI controllers
+ scsibus* at aha?
+ ahb0 at isa? port ? irq ? # Adaptec 174[024] SCSI controllers
+ scsibus* at ahb?
+ aic0 at isa? port 0x340 irq 12 # Adaptec 152[02] SCSI controllers
+ scsibus* at aic?
+ bt0 at isa? port 0x330 irq ? drq ? # BusLogic [57]4X SCSI controllers
+ bt1 at isa? port 0x334 irq ? drq ? # BusLogic [57]4X SCSI controllers
+ bt2 at isa? port ? irq ?
+ scsibus* at bt?
+ ncr* at pci? bus ? dev ? # NCR 538XX SCSI controllers
+ scsibus* at ncr?
+ sea0 at isa? iomem 0xc8000 irq 5
+ scsibus* at sea?
+ uha0 at isa? port 0x330 irq ? drq ? # UltraStor [13]4f SCSI controllers
+ uha1 at isa? port 0x334 irq ? drq ? # UltraStor [13]4f SCSI controllers
+ uha2 at isa? port ? irq ? # UltraStor 24f SCSI controllers
+ scsibus* at uha?
+
+ sd* at scsibus? target ? lun ? # SCSI disk drives
+ st* at scsibus? target ? lun ? # SCSI tape drives
+ cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
+ ch* at scsibus? target ? lun ? # SCSI autochangers
+
+ fdc0 at isa? port 0x3f0 irq 6 drq 2 # standard PC floppy controllers
+ #fdc1 at isa? port 0x370 irq ? drq ?
+ fd* at fdc? drive ?
+
+ mcd0 at isa? port 0x300 irq 10 # Mitsumi CD-ROM drives
+
+ wdc0 at isa? port 0x1f0 irq 14 # ST506, ESDI, and IDE controllers
+ #wdc1 at isa? port 0x170 irq ?
+ wd* at wdc? drive ?
+
+ wt0 at isa? port 0x300 irq 5 drq 1 # Archive and Wangtek QIC tape drives
+
+ ed0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC, 3C503, and NE[12]000
+ ed1 at isa? port 0x250 iomem 0xd8000 irq 9 # ethernet cards
+ ed2 at isa? port 0x300 iomem 0xcc000 irq 10
+ #eg0 at isa? ... # 3C505 ethernet cards
+ el0 at isa? port 0x300 irq 9 # 3C501 ethernet cards
+ ep0 at isa? port ? irq ? # 3C509 ethernet cards
+ ie0 at isa? port 0x360 iomem 0xd0000 irq 7 # StarLAN & 3C507 ethernet cards
+ #le0 at isa? port 0x320 irq 10 drq 7 # IsoLan, NE2100, and DEPCA
+ de* at pci? bus ? dev ?
+
+ pss0 at isa? port 0x220 irq 7 drq 6 # Personal Sound System
+ sp0 at pss0 port 0x530 irq 10 drq 0 # sound port driver
+
+ sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster
+ wss0 at isa? port 0x530 irq 10 drq 0 # Windows Sound System
+ pas0 at isa? port 0x220 irq 7 drq 1 # ProAudio Spectrum
+ gus0 at isa? port 0x220 irq 7 drq 1 flags 6 # Gravis Ultra Sound (flags is record drq for full-duplex)
+ #spkr0 at isa? ...
+
+ pseudo-device loop 1 # network loopback
+ pseudo-device bpfilter 8 # packet filter
+ pseudo-device sl 2 # CSLIP
+ pseudo-device ppp 2 # PPP
+ pseudo-device tun 2 # network tunneling over tty
+
+ pseudo-device pty 64 # pseudo-terminals
+ pseudo-device tb 1 # tablet line discipline
+ pseudo-device vnd 4 # paging to files
*** old-NetBSD/src/sys/dev/cons.h
--- NetBSD/src/sys/dev/cons.h
***************
*** 80,85 ****
--- 80,86 ----
int cnselect __P((dev_t, int, struct proc *));
int cngetc __P((void));
int cnputc __P((int));
+ void nullcnpollc __P((int));
/* console-specific types */
#define dev_type_cnprobe(n) void n __P((struct consdev *))
*** old-NetBSD/src/sys/dev/ic/dp8390reg.h
--- NetBSD/src/sys/dev/ic/dp8390reg.h
***************
*** 530,536 ****
* was received.
*/
struct ed_ring {
! #if BYTE_ORDER == BIG_ENDIAN
u_char next_packet; /* pointer to next packet */
u_char rsr; /* receiver status */
#else
--- 530,536 ----
* was received.
*/
struct ed_ring {
! #if ED_BYTE_ORDER == BIG_ENDIAN
u_char next_packet; /* pointer to next packet */
u_char rsr; /* receiver status */
#else
*** old-NetBSD/src/sys/dev/isa/com.c
--- NetBSD/src/sys/dev/isa/com.c
***************
*** 100,105 ****
--- 100,106 ----
void compoll __P((void *));
int comparam __P((struct tty *, struct termios *));
void comstart __P((struct tty *));
+ int comhwiflow __P((struct tty *, int));
struct cfdriver comcd = {
NULL, "com", comprobe, comattach, DV_TTY, sizeof(struct com_softc)
***************
*** 282,287 ****
--- 283,289 ----
tp->t_oproc = comstart;
tp->t_param = comparam;
+ tp->t_hwiflow = comhwiflow;
tp->t_dev = dev;
if ((tp->t_state & TS_ISOPEN) == 0) {
tp->t_state |= TS_WOPEN;
***************
*** 879,884 ****
--- 881,915 ----
if (inb(iobase + com_iir) & IIR_NOPEND)
return (1);
}
+ }
+
+ int
+ comhwiflow(tp, flag)
+ struct tty *tp;
+ int flag;
+ {
+ struct com_softc *sc = comcd.cd_devs[COMUNIT(tp->t_dev)];
+ int iobase = sc->sc_iobase;
+ int s;
+ static unsigned int startusec, startticks;
+ extern int ticks;
+ int elapsed;
+
+ s = spltty();
+ if (flag) {
+ sc->sc_mcr &= ~MCR_RTS;
+ startusec = clkread();
+ startticks = ticks;
+ } else {
+ elapsed = clkread() - startusec + (ticks - startticks) * 10000;
+ sc->sc_mcr |= MCR_RTS;
+ }
+ outb(iobase + com_mcr, sc->sc_mcr);
+ splx(s);
+ if (!flag)
+ printf ("%s: comhwiflow %d ms\n", sc->sc_dev.dv_xname,
+ elapsed / 1000);
+ return 1;
}
/*
*** old-NetBSD/src/sys/dev/isa/if_ed.c
--- NetBSD/src/sys/dev/isa/if_ed.c
***************
*** 518,524 ****
(void) inb(0x84);
/* Now zero memory and verify that it is clear. */
! bzero(sc->mem_start, memsize);
for (i = 0; i < memsize; ++i)
if (sc->mem_start[i]) {
--- 518,524 ----
(void) inb(0x84);
/* Now zero memory and verify that it is clear. */
! isa_zero(sc->mem_start, memsize);
for (i = 0; i < memsize; ++i)
if (sc->mem_start[i]) {
***************
*** 784,790 ****
outb(sc->asic_addr + ED_3COM_VPTR0, 0x00);
/* Zero memory and verify that it is clear. */
! bzero(sc->mem_start, memsize);
for (i = 0; i < memsize; ++i)
if (sc->mem_start[i]) {
--- 784,790 ----
outb(sc->asic_addr + ED_3COM_VPTR0, 0x00);
/* Zero memory and verify that it is clear. */
! isa_zero(sc->mem_start, memsize);
for (i = 0; i < memsize; ++i)
if (sc->mem_start[i]) {
***************
*** 1401,1407 ****
}
for (m = m0; m != 0; m = m->m_next) {
! bcopy(mtod(m, caddr_t), buffer, m->m_len);
buffer += m->m_len;
}
len = m0->m_pkthdr.len;
--- 1401,1407 ----
}
for (m = m0; m != 0; m = m->m_next) {
! copy_to_isa(mtod(m, caddr_t), buffer, m->m_len);
buffer += m->m_len;
}
len = m0->m_pkthdr.len;
***************
*** 1488,1494 ****
else
ed_pio_readmem(sc, (long)packet_ptr,
(caddr_t) &packet_hdr, sizeof(packet_hdr));
! len = packet_hdr.count;
/*
* Try do deal with old, buggy chips that sometimes duplicate
--- 1488,1494 ----
else
ed_pio_readmem(sc, (long)packet_ptr,
(caddr_t) &packet_hdr, sizeof(packet_hdr));
! len = itohs(packet_hdr.count);
/*
* Try do deal with old, buggy chips that sometimes duplicate
***************
*** 1508,1518 ****
--nlen;
len = (len & ED_PAGE_MASK) | (nlen << ED_PAGE_SHIFT);
#ifdef DIAGNOSTIC
! if (len != packet_hdr.count) {
printf("%s: length does not match next packet pointer\n",
sc->sc_dev.dv_xname);
printf("%s: len %04x nlen %04x start %02x first %02x curr %02x next %02x stop %02x\n",
! sc->sc_dev.dv_xname, packet_hdr.count, len,
sc->rec_page_start, sc->next_packet, current,
packet_hdr.next_packet, sc->rec_page_stop);
}
--- 1508,1518 ----
--nlen;
len = (len & ED_PAGE_MASK) | (nlen << ED_PAGE_SHIFT);
#ifdef DIAGNOSTIC
! if (len != itohs(packet_hdr.count)) {
printf("%s: length does not match next packet pointer\n",
sc->sc_dev.dv_xname);
printf("%s: len %04x nlen %04x start %02x first %02x curr %02x next %02x stop %02x\n",
! sc->sc_dev.dv_xname, itohs(packet_hdr.count), len,
sc->rec_page_start, sc->next_packet, current,
packet_hdr.next_packet, sc->rec_page_stop);
}
***************
*** 2119,2125 ****
/* Copy amount up to end of NIC memory. */
if (sc->mem_shared)
! bcopy(src, dst, tmp_amount);
else
ed_pio_readmem(sc, (long)src, dst, tmp_amount);
--- 2119,2125 ----
/* Copy amount up to end of NIC memory. */
if (sc->mem_shared)
! copy_from_isa(src, dst, tmp_amount);
else
ed_pio_readmem(sc, (long)src, dst, tmp_amount);
***************
*** 2129,2135 ****
}
if (sc->mem_shared)
! bcopy(src, dst, amount);
else
ed_pio_readmem(sc, (long)src, dst, amount);
--- 2129,2135 ----
}
if (sc->mem_shared)
! copy_from_isa(src, dst, amount);
else
ed_pio_readmem(sc, (long)src, dst, amount);
*** old-NetBSD/src/sys/kern/exec_conf.c
--- NetBSD/src/sys/kern/exec_conf.c
***************
*** 37,42 ****
--- 37,46 ----
#define EXEC_ECOFF
#endif
+ #if defined(COMPAT_NCR32)
+ #define EXEC_COFF
+ #endif
+
#if defined(COMPAT_SVR4) || defined(COMPAT_LINUX)
#define EXEC_ELF
#endif
***************
*** 56,61 ****
--- 60,69 ----
#include <sys/exec_ecoff.h>
#endif
+ #ifdef EXEC_COFF
+ #include <sys/exec_coff.h>
+ #endif
+
#ifdef EXEC_ELF
#include <sys/exec_elf.h>
#endif
***************
*** 88,93 ****
--- 96,104 ----
#endif
#ifdef EXEC_ECOFF
{ ECOFF_HDR_SIZE, exec_ecoff_makecmds, }, /* ecoff binaries */
+ #endif
+ #ifdef EXEC_COFF
+ { COFF_HDR_SIZE, exec_coff_makecmds, }, /* coff binaries */
#endif
#ifdef EXEC_ELF
{ ELF_HDR_SIZE, exec_elf_makecmds, }, /* elf binaries */
*** old-NetBSD/src/sys/kern/kern_lkm.c
--- NetBSD/src/sys/kern/kern_lkm.c
***************
*** 81,86 ****
--- 81,90 ----
static struct lkm_table lkmods[MAXLKMS]; /* table of loaded modules */
static struct lkm_table *curp; /* global for in-progress ops */
+ #ifdef DEBUG
+ int lkm_debug = 0;
+ #endif
+
/*ARGSUSED*/
int
lkmopen(dev, flag, devtype, p)
***************
*** 148,154 ****
if (!(lkm_v & LKM_ALLOC)) {
#ifdef DEBUG
! printf("LKM: close before open!\n");
#endif /* DEBUG */
return (EBADF);
}
--- 152,159 ----
if (!(lkm_v & LKM_ALLOC)) {
#ifdef DEBUG
! if (lkm_debug)
! printf("LKM: close before open!\n");
#endif /* DEBUG */
return (EBADF);
}
***************
*** 220,228 ****
resrvp->addr = curp->area; /* ret kernel addr */
#ifdef DEBUG
! printf("LKM: LMRESERV (actual = 0x%08x)\n", curp->area);
! printf("LKM: LMRESERV (adjusted = 0x%08x)\n",
! trunc_page(curp->area));
#endif /* DEBUG */
lkm_state = LKMS_RESERVED;
break;
--- 225,235 ----
resrvp->addr = curp->area; /* ret kernel addr */
#ifdef DEBUG
! if (lkm_debug) {
! printf("LKM: LMRESERV (actual = 0x%08x)\n", curp->area);
! printf("LKM: LMRESERV (adjusted = 0x%08x)\n",
! trunc_page(curp->area));
! }
#endif /* DEBUG */
lkm_state = LKMS_RESERVED;
break;
***************
*** 248,260 ****
if ((curp->offset + i) < curp->size) {
lkm_state = LKMS_LOADING;
#ifdef DEBUG
! printf("LKM: LMLOADBUF (loading @ %d of %d, i = %d)\n",
! curp->offset, curp->size, i);
#endif /* DEBUG */
} else {
lkm_state = LKMS_LOADED;
#ifdef DEBUG
! printf("LKM: LMLOADBUF (loaded)\n");
#endif /* DEBUG */
}
curp->offset += i;
--- 255,269 ----
if ((curp->offset + i) < curp->size) {
lkm_state = LKMS_LOADING;
#ifdef DEBUG
! if (lkm_debug)
! printf("LKM: LMLOADBUF (loading @ %d of %d, i = %d)\n",
! curp->offset, curp->size, i);
#endif /* DEBUG */
} else {
lkm_state = LKMS_LOADED;
#ifdef DEBUG
! if (lkm_debug)
! printf("LKM: LMLOADBUF (loaded)\n");
#endif /* DEBUG */
}
curp->offset += i;
***************
*** 266,272 ****
lkmunreserve(); /* coerce state to LKM_IDLE */
#ifdef DEBUG
! printf("LKM: LMUNRESERV\n");
#endif /* DEBUG */
break;
--- 275,282 ----
lkmunreserve(); /* coerce state to LKM_IDLE */
#ifdef DEBUG
! if (lkm_debug)
! printf("LKM: LMUNRESERV\n");
#endif /* DEBUG */
break;
***************
*** 285,291 ****
default:
#ifdef DEBUG
! printf("lkm_state is %02x\n", lkm_state);
#endif /* DEBUG */
return ENXIO;
}
--- 295,302 ----
default:
#ifdef DEBUG
! if (lkm_debug)
! printf("lkm_state is %02x\n", lkm_state);
#endif /* DEBUG */
return ENXIO;
}
***************
*** 306,312 ****
curp->used = 1;
#ifdef DEBUG
! printf("LKM: LMREADY\n");
#endif /* DEBUG */
lkm_state = LKMS_IDLE;
break;
--- 317,324 ----
curp->used = 1;
#ifdef DEBUG
! if (lkm_debug)
! printf("LKM: LMREADY\n");
#endif /* DEBUG */
lkm_state = LKMS_IDLE;
break;
*** old-NetBSD/src/sys/kern/tty.c
--- NetBSD/src/sys/kern/tty.c
***************
*** 1045,1058 ****
*/
if (total >= TTYHOG / 2 &&
!ISSET(tp->t_state, TS_TBLOCK) &&
! !ISSET(tp->t_lflag, ICANON) || tp->t_canq.c_cc > 0) {
if (ISSET(tp->t_iflag, IXOFF) &&
tp->t_cc[VSTOP] != _POSIX_VDISABLE &&
putc(tp->t_cc[VSTOP], &tp->t_outq) == 0) {
! SET(tp->t_state, TS_TBLOCK);
ttstart(tp);
}
! /* Try to block remote output via hardware flow control. */
if (ISSET(tp->t_cflag, CHWFLOW) && tp->t_hwiflow &&
(*tp->t_hwiflow)(tp, 1) != 0)
SET(tp->t_state, TS_TBLOCK);
--- 1045,1058 ----
*/
if (total >= TTYHOG / 2 &&
!ISSET(tp->t_state, TS_TBLOCK) &&
! (!ISSET(tp->t_lflag, ICANON) || tp->t_canq.c_cc > 0)) {
if (ISSET(tp->t_iflag, IXOFF) &&
tp->t_cc[VSTOP] != _POSIX_VDISABLE &&
putc(tp->t_cc[VSTOP], &tp->t_outq) == 0) {
! SET(tp->t_state, TS_TBLOCK);
ttstart(tp);
}
! /* Try to block remote output via hardware flow control */
if (ISSET(tp->t_cflag, CHWFLOW) && tp->t_hwiflow &&
(*tp->t_hwiflow)(tp, 1) != 0)
SET(tp->t_state, TS_TBLOCK);
***************
*** 1379,1388 ****
CLR(tp->t_state, TS_TBLOCK);
ttstart(tp);
}
! /* Try to unblock remote output via hardware flow control. */
if (ISSET(tp->t_cflag, CHWFLOW) && tp->t_hwiflow &&
(*tp->t_hwiflow)(tp, 0) != 0)
! CLR(tp->t_state, TS_TBLOCK);
}
splx(s);
return (error);
--- 1379,1388 ----
CLR(tp->t_state, TS_TBLOCK);
ttstart(tp);
}
! /* Try to unblock remote output via hardware flow control */
if (ISSET(tp->t_cflag, CHWFLOW) && tp->t_hwiflow &&
(*tp->t_hwiflow)(tp, 0) != 0)
! tp->t_state &= ~TS_TBLOCK;
}
splx(s);
return (error);
*** old-NetBSD/src/sys/lib/libkern/arch/m68k/Makefile.inc
--- NetBSD/src/sys/lib/libkern/arch/m68k/Makefile.inc
***************
*** 2,5 ****
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
bcmp.S bzero.S ffs.S strcat.c strcmp.S strcpy.S strlen.S strncmp.S \
! strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S
--- 2,6 ----
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
bcmp.S bzero.S ffs.S strcat.c strcmp.S strcpy.S strlen.S strncmp.S \
! strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S \
! memcpy.S
*** /dev/null
--- NetBSD/src/sys/lib/libkern/arch/m68k/bcopy.S
***************
*** 0 ****
--- 1,132 ----
+ /*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+ #if defined(LIBC_SCCS) && !defined(lint)
+ .text
+ /*.asciz "from: @(#)bcopy.s 5.1 (Berkeley) 5/12/90"*/
+ .asciz "$Id$"
+ #endif /* LIBC_SCCS and not lint */
+
+ #include "DEFS.h"
+
+ /*
+ * This is probably not the best we can do, but it is still 2-10 times
+ * faster than the C version in the portable gen directory.
+ *
+ * Things that might help:
+ * - unroll the longword copy loop (might not be good for a 68020)
+ * - longword align when possible (only on the 68020)
+ * - use nested DBcc instructions or use one and limit size to 64K
+ */
+ #ifdef MEMCOPY
+ ENTRY(memcpy)
+ #else
+ #ifdef MEMMOVE
+ ENTRY(memmove)
+ #else
+ ENTRY(bcopy)
+ #endif
+ #endif
+ movl sp@(12),d1 | check count
+ beq bcdone | == 0, don't do anything
+ #if defined(MEMCOPY) || defined(MEMMOVE)
+ movl sp@(4),a1 | dest address
+ movl sp@(8),a0 | src address
+ #else
+ movl sp@(4),a0 | src address
+ movl sp@(8),a1 | dest address
+ #endif
+ cmpl a1,a0 | src after dest?
+ blt bcback | yes, must copy backwards
+ movl a0,d0
+ btst #0,d0 | src address odd?
+ beq bcfeven | no, skip alignment
+ movb a0@+,a1@+ | yes, copy a byte
+ subql #1,d1 | adjust count
+ beq bcdone | count 0, all done
+ bcfeven:
+ movl a1,d0
+ btst #0,d0 | dest address odd?
+ bne bcfbloop | yes, no hope for alignment, copy bytes
+ movl d1,d0 | no, both even
+ lsrl #2,d0 | convert count to longword count
+ beq bcfbloop | count 0, skip longword loop
+ bcflloop:
+ movl a0@+,a1@+ | copy a longword
+ subql #1,d0 | adjust count
+ bne bcflloop | still more, keep copying
+ andl #3,d1 | what remains
+ beq bcdone | nothing, all done
+ bcfbloop:
+ movb a0@+,a1@+ | copy a byte
+ subql #1,d1 | adjust count
+ bne bcfbloop | still more, keep going
+ bcdone:
+ #if defined(MEMCOPY) || defined(MEMMOVE)
+ movl sp@(4),d0 | dest address
+ #endif
+ rts
+ bcback:
+ addl d1,a0 | src pointer to end
+ addl d1,a1 | dest pointer to end
+ movl a0,d0
+ btst #0,d0 | src address odd?
+ beq bcbeven | no, skip alignment
+ movb a0@-,a1@- | yes, copy a byte
+ subql #1,d1 | adjust count
+ beq bcdone | count 0, all done
+ bcbeven:
+ movl a1,d0
+ btst #0,d0 | dest address odd?
+ bne bcbbloop | yes, no hope for alignment, copy bytes
+ movl d1,d0 | no, both even
+ lsrl #2,d0 | convert count to longword count
+ beq bcbbloop | count 0, skip longword loop
+ bcblloop:
+ movl a0@-,a1@- | copy a longword
+ subql #1,d0 | adjust count
+ bne bcblloop | still more, keep copying
+ andl #3,d1 | what remains
+ beq bcdone | nothing, all done
+ bcbbloop:
+ movb a0@-,a1@- | copy a byte
+ subql #1,d1 | adjust count
+ bne bcbbloop | still more, keep going
+ #if defined(MEMCOPY) || defined(MEMMOVE)
+ movl sp@(4),d0 | dest address
+ #endif
+ rts
*** /dev/null
--- NetBSD/src/sys/lib/libkern/arch/m68k/memcpy.S
***************
*** 0 ****
--- 1,2 ----
+ #define MEMCOPY
+ #include "bcopy.S"
*** old-NetBSD/src/sys/scsi/scsi_ioctl.c
--- NetBSD/src/sys/scsi/scsi_ioctl.c
***************
*** 166,172 ****
screq->retsts = SCCMD_UNKNOWN;
break;
}
! biodone(bp); /* we're waiting on it in scsi_strategy() */
}
--- 166,172 ----
screq->retsts = SCCMD_UNKNOWN;
break;
}
! biodone(bp); /* we're waiting on it in scsistrategy() */
}
*** old-NetBSD/src/sys/sys/mount.h
--- NetBSD/src/sys/sys/mount.h
***************
*** 380,388 ****
struct adosfs_args {
char *fspec; /* blocks special holding the fs to mount */
struct export_args export; /* network export information */
! uid_t uid; /* uid that owns msdosfs files */
! gid_t gid; /* gid that owns msdosfs files */
! mode_t mask; /* mask to be applied for msdosfs perms */
};
#ifdef _KERNEL
--- 380,388 ----
struct adosfs_args {
char *fspec; /* blocks special holding the fs to mount */
struct export_args export; /* network export information */
! uid_t uid; /* uid that owns adosfs files */
! gid_t gid; /* gid that owns adosfs files */
! mode_t mask; /* mask to be applied for adosfs perms */
};
#ifdef _KERNEL
*** old-NetBSD/src/sys/vm/swap_pager.c
--- NetBSD/src/sys/vm/swap_pager.c
***************
*** 71,77 ****
#endif
#ifdef DEBUG
! int swpagerdebug = 0x100;
#define SDB_FOLLOW 0x001
#define SDB_INIT 0x002
#define SDB_ALLOC 0x004
--- 71,77 ----
#endif
#ifdef DEBUG
! int swpagerdebug = 0x000;
#define SDB_FOLLOW 0x001
#define SDB_INIT 0x002
#define SDB_ALLOC 0x004
*** old-NetBSD/src/usr.bin/kdump/kdump.c
--- NetBSD/src/usr.bin/kdump/kdump.c
***************
*** 109,116 ****
--- 109,134 ----
{ NULL, NULL, NULL }
};
+ struct emulation_map {
+ struct emulation_map *em_link;
+ pid_t em_pid;
+ struct emulation *em_emulation;
+ };
+
+ /* Forward decls. */
+ struct emulation *emulation_from_name __P((char *name));
+ struct emulation *emulation_from_pid __P((pid_t pid));
+ void bind_emulation_to_pid __P((struct emulation *, pid_t));
+
+ /* A mapping between pids and emulations currently in charge. */
+ struct emulation_map *current_emulations;
+
+ /* The current emulation (cache during a single trace event). */
struct emulation *current;
+ /* The default emulation, if nothing else is known. */
+ struct emulation *default_emulation;
+
static char *ptrace_ops[] = {
"PT_TRACE_ME", "PT_READ_I", "PT_READ_D", "PT_READ_U",
***************
*** 127,138 ****
register void *m;
int trpoints = ALL_POINTS;
! current = &emulations[0]; /* NetBSD */
while ((ch = getopt(argc, argv, "e:f:dlm:nRTt:")) != -1)
switch (ch) {
case 'e':
! setemul(optarg);
break;
case 'f':
tracefile = optarg;
--- 145,156 ----
register void *m;
int trpoints = ALL_POINTS;
! default_emulation = &emulations[0]; /* NetBSD */
while ((ch = getopt(argc, argv, "e:f:dlm:nRTt:")) != -1)
switch (ch) {
case 'e':
! default_emulation = emulation_from_name(optarg);
break;
case 'f':
tracefile = optarg;
***************
*** 175,180 ****
--- 193,199 ----
if (!freopen(tracefile, "r", stdin))
err(1, "%s", tracefile);
while (fread_tail(&ktr_header, sizeof(struct ktr_header), 1)) {
+ current = emulation_from_pid(ktr_header.ktr_pid);
if (trpoints & (1<<ktr_header.ktr_type))
dumpheader(&ktr_header);
if ((ktrlen = ktr_header.ktr_len) < 0)
***************
*** 209,215 ****
ktrcsw((struct ktr_csw *)m);
break;
case KTR_EMUL:
! ktremul(m, ktrlen);
break;
}
if (tail)
--- 228,234 ----
ktrcsw((struct ktr_csw *)m);
break;
case KTR_EMUL:
! ktremul(m, ktrlen, ktr_header.ktr_pid);
break;
}
if (tail)
***************
*** 378,385 ****
(void)printf("\"%.*s\"\n", len, cp);
}
! ktremul(cp, len)
char *cp;
{
char name[1024];
--- 397,405 ----
(void)printf("\"%.*s\"\n", len, cp);
}
! ktremul(cp, len, pid)
char *cp;
+ pid_t pid;
{
char name[1024];
***************
*** 390,396 ****
name[len] = '\0';
(void)printf("\"%s\"\n", name);
! setemul(name);
}
ktrgenio(ktr, len)
--- 410,416 ----
name[len] = '\0';
(void)printf("\"%s\"\n", name);
! bind_emulation_to_pid(emulation_from_name(name), pid);
}
ktrgenio(ktr, len)
***************
*** 481,494 ****
exit(1);
}
! setemul(name)
char *name;
{
int i;
for (i = 0; emulations[i].name != NULL; i++)
if (strcmp(emulations[i].name, name) == 0) {
! current = &emulations[i];
! return;
}
warnx("Emulation `%s' unknown", name);
}
--- 501,549 ----
exit(1);
}
! struct emulation *
! emulation_from_name(name)
char *name;
{
int i;
for (i = 0; emulations[i].name != NULL; i++)
if (strcmp(emulations[i].name, name) == 0) {
! return &emulations[i];
}
warnx("Emulation `%s' unknown", name);
+ return default_emulation;
+ }
+
+ struct emulation *
+ emulation_from_pid(pid)
+ pid_t pid;
+ {
+ struct emulation_map *entry;
+
+ for (entry = current_emulations; entry; entry = entry->em_link)
+ if (entry->em_pid == pid)
+ return entry->em_emulation;
+ return default_emulation;
+ }
+
+ void
+ bind_emulation_to_pid(emulation, pid)
+ struct emulation *emulation;
+ pid_t pid;
+ {
+ struct emulation_map *entry;
+
+ for (entry = current_emulations; entry; entry = entry->em_link)
+ if (entry->em_pid == pid) {
+ entry->em_emulation = emulation;
+ return;
+ }
+ entry = current_emulations;
+ current_emulations =
+ (struct emulation_map *)malloc(sizeof(struct emulation_map));
+ if (current_emulations == NULL)
+ errx(1, "%s", strerror(ENOMEM));
+ current_emulations->em_link = entry;
+ current_emulations->em_pid = pid;
+ current_emulations->em_emulation = emulation;
}